3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i = 1; if ( preg_match('~^\d{3}$~', "123", $match) ) echo $i++, ') ', $match[0], PHP_EOL; // 123 if ( preg_match('~^\d{3}$~', "123\n", $match) ) echo $i++, ') ', $match[0], PHP_EOL; // 123 (et pourtant ce n'est pas la fin de la chaîne) // même comportement si je modifie la séquence de nouvelle ligne par défaut if ( preg_match('~(*CR)^\d{3}$~', "123\r", $match) ) echo $i++, ') ', $match[0], PHP_EOL; // 123 if ( preg_match('~(*CRLF)^\d{3}$~', "123\r\n", $match) ) echo $i++, ') ', $match[0], PHP_EOL; // 123 if ( preg_match('~(*NUL)^\d{3}$~', "123\x00", $match) ) echo $i++, ') ', $match[0], PHP_EOL; // 123 if ( preg_match('~(*ANY)^\d{3}$~', "123\x85", $match) ) echo $i++, ') ', $match[0], PHP_EOL; // 123
Output for 7.4.0 - 7.4.33, 8.0.0 - 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
1) 123 2) 123 3) 123 4) 123 5) 123 6) 123
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.
Output for 7.3.0 - 7.3.33
1) 123 2) 123 3) 123 4) 123 Warning: preg_match(): JIT compilation failed: internal error - pattern overwritten? in /in/Gec8R on line 17 5) 123 6) 123
Output for 7.2.0 - 7.2.33
1) 123 2) 123 3) 123 4) 123 Warning: preg_match(): Compilation failed: (*VERB) not recognized or malformed at offset 5 in /in/Gec8R on line 17 5) 123

preferences:
152.83 ms | 410 KiB | 5 Q