3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php preg_match("/^(?<NAME_A>aaa)(?:(?<NAME_B>x)?)/", "aaay", $matches, PREG_UNMATCHED_AS_NULL); var_dump($matches);
based on N4g1t
Output for 7.2.0 - 7.2.6
array(3) { [0]=> string(3) "aaa" ["NAME_A"]=> string(3) "aaa" [1]=> string(3) "aaa" }
Output for hhvm-3.18.5 - 3.21.3, 7.1.0 - 7.1.20
Notice: Use of undefined constant PREG_UNMATCHED_AS_NULL - assumed 'PREG_UNMATCHED_AS_NULL' in /in/em6fi on line 3 Warning: preg_match() expects parameter 4 to be integer, string given in /in/em6fi on line 3 NULL
Output for hhvm-3.22.0
Notice: Use of undefined constant PREG_UNMATCHED_AS_NULL - assumed 'PREG_UNMATCHED_AS_NULL' in /in/em6fi on line -1 Warning: preg_match() expects parameter 4 to be integer, string given in /in/em6fi on line -1 NULL
Output for 5.6.0 - 5.6.30
Notice: Use of undefined constant PREG_UNMATCHED_AS_NULL - assumed 'PREG_UNMATCHED_AS_NULL' in /in/em6fi on line 3 Warning: preg_match() expects parameter 4 to be long, string given in /in/em6fi on line 3 NULL