3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php var_export(preg_match('~foo~', 'foo', $string)); var_export(preg_match('~foo~', 'bar', $string)); var_export(preg_match('~foo', 'foo', $string)); if (PREG_INTERNAL_ERROR === preg_last_error()) { echo "internal error\n"; }
Output for 5.2.0 - 5.6.28, 7.0.0 - 7.1.0
10 Warning: preg_match(): No ending delimiter '~' found in /in/32j3D on line 5 false
Output for hhvm-3.10.0 - 3.12.0
10 Warning: No ending delimiter '~' found: [~foo] in /in/32j3D on line 5 false
Output for 5.0.0 - 5.1.6
10 Warning: preg_match(): No ending delimiter '~' found in /in/32j3D on line 5 false Notice: Use of undefined constant PREG_INTERNAL_ERROR - assumed 'PREG_INTERNAL_ERROR' in /in/32j3D on line 7 Fatal error: Call to undefined function preg_last_error() in /in/32j3D on line 7
Process exited with code 255.
Output for 4.4.5 - 4.4.9
10 Warning: preg_match(): No ending delimiter '~' found in /in/32j3D on line 5 false Notice: Use of undefined constant PREG_INTERNAL_ERROR - assumed 'PREG_INTERNAL_ERROR' in /in/32j3D on line 7 Fatal error: Call to undefined function: preg_last_error() in /in/32j3D on line 7
Process exited with code 255.
Output for 4.3.11 - 4.4.4
10 Warning: preg_match(): No ending delimiter '~' found in /in/32j3D on line 5 false Notice: Use of undefined constant PREG_INTERNAL_ERROR - assumed 'PREG_INTERNAL_ERROR' in /in/32j3D on line 7 Fatal error: Call to undefined function: preg_last_error() in /in/32j3D on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.10
10 Warning: No ending delimiter '~' found in /in/32j3D on line 5 false Notice: Use of undefined constant PREG_INTERNAL_ERROR - assumed 'PREG_INTERNAL_ERROR' in /in/32j3D on line 7 Fatal error: Call to undefined function: preg_last_error() in /in/32j3D on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
10 Warning: No ending delimiter '~' found in /in/32j3D on line 5 false Notice: Use of undefined constant PREG_INTERNAL_ERROR - assumed 'PREG_INTERNAL_ERROR' in /in/32j3D on line 7 Fatal error: Call to undefined function: preg_last_error() in /in/32j3D on line 7