3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ " \ntest1 \n \t \ntest1\n\n " => "test1\ntest1", " \r\ntest2 \r\n \t \r\ntest2\r\n\r\n " => "test2\r\ntest2", " \u{0085}test3 \u{0085} \t \u{0085}test3\u{0085}\u{0085} " => "test3\u{0085}test3", " \u{2029}test4 \u{2029} \t \u{2029}test4\u{2029}\u{2029} " => "test4\u{2029}test4", " \ftest5 \f \t \ftest5\f\f " => "test5\ftest5", " \rtest6 \r \t \r\rtest6\r\r " => "test6\rtest6", ]; $i = 0; $pattern = '~(*ANY)\A\s*\R|\s*(?!\r\n)\s$~mu'; foreach($tests as $input => $output) { echo 'Test', ++$i, ': ', (preg_replace($pattern, '', $input) === $output ? 'SUCCESS':'FAIL'), PHP_EOL; }
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
Test1: SUCCESS Test2: SUCCESS Test3: SUCCESS Test4: SUCCESS Test5: SUCCESS Test6: SUCCESS
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
83 ms | 407 KiB | 5 Q