3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php var_dump(preg_match('[0-9a-zA-Z]', 'bob', $matches), $matches); echo '---------', PHP_EOL; var_dump(preg_match('~[0-9a-zA-Z]~', 'bob', $matches), $matches); echo '---------', PHP_EOL; var_dump(preg_match('~[0-9a-zA-Z]+~', 'bob', $matches), $matches);
based on d3cEu
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
int(0) array(0) { } --------- int(1) array(1) { [0]=> string(1) "b" } --------- int(1) array(1) { [0]=> string(3) "bob" }
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
int(0) array(0) { } --------- Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/o8IIR on line 6 PHP_EOLint(1) array(1) { [0]=> string(1) "b" } --------- Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/o8IIR on line 8 PHP_EOLint(1) array(1) { [0]=> string(3) "bob" }