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)); var_export(preg_last_error());
Output for 5.2.0 - 7.1.0
10 Warning: preg_match(): No ending delimiter '~' found in /in/Q9KHs on line 5 false0
Output for 5.0.0 - 5.1.6
10 Warning: preg_match(): No ending delimiter '~' found in /in/Q9KHs on line 5 false Fatal error: Call to undefined function preg_last_error() in /in/Q9KHs on line 6
Process exited with code 255.
Output for 4.4.5 - 4.4.9
10 Warning: preg_match(): No ending delimiter '~' found in /in/Q9KHs on line 5 false Fatal error: Call to undefined function: preg_last_error() in /in/Q9KHs on line 6
Process exited with code 255.
Output for 4.3.11 - 4.4.4
10 Warning: preg_match(): No ending delimiter '~' found in /in/Q9KHs on line 5 false Fatal error: Call to undefined function: preg_last_error() in /in/Q9KHs on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.10
10 Warning: No ending delimiter '~' found in /in/Q9KHs on line 5 false Fatal error: Call to undefined function: preg_last_error() in /in/Q9KHs on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
10 Warning: No ending delimiter '~' found in /in/Q9KHs on line 5 false Fatal error: Call to undefined function: preg_last_error() in /in/Q9KHs on line 6