3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $regex = '#(?P<param>[^/]+)#'; var_dump(preg_match($regex, 'moo', $match), $match); $regex = '#(?<param>[^/]+)#'; var_dump(preg_match($regex, 'moo', $match), $match); $regex = "#(?'param'[^/]+)#"; var_dump(preg_match($regex, 'moo', $match), $match);
Output for 4.4.6 - 4.4.9, 5.2.2 - 7.1.0
int(1) array(3) { [0]=> string(3) "moo" ["param"]=> string(3) "moo" [1]=> string(3) "moo" } int(1) array(3) { [0]=> string(3) "moo" ["param"]=> string(3) "moo" [1]=> string(3) "moo" } int(1) array(3) { [0]=> string(3) "moo" ["param"]=> string(3) "moo" [1]=> string(3) "moo" }
Output for 5.2.0 - 5.2.1
int(1) array(3) { [0]=> string(3) "moo" ["param"]=> string(3) "moo" [1]=> string(3) "moo" } Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 3 in /in/6c1Bi on line 7 bool(false) array(3) { [0]=> string(3) "moo" ["param"]=> string(3) "moo" [1]=> string(3) "moo" } Warning: preg_match(): Compilation failed: unrecognized character after (? at offset 2 in /in/6c1Bi on line 10 bool(false) array(3) { [0]=> string(3) "moo" ["param"]=> string(3) "moo" [1]=> string(3) "moo" }
Output for 4.3.11 - 4.4.5, 5.0.0 - 5.1.6
int(1) array(3) { [0]=> string(3) "moo" ["param"]=> string(3) "moo" [1]=> string(3) "moo" } Warning: preg_match(): Compilation failed: unrecognized character after (?< at offset 3 in /in/6c1Bi on line 7 bool(false) array(0) { } Warning: preg_match(): Compilation failed: unrecognized character after (? at offset 2 in /in/6c1Bi on line 10 bool(false) array(0) { }
Output for 4.3.3 - 4.3.10
int(1) array(3) { [0]=> string(3) "moo" ["param"]=> string(3) "moo" [1]=> string(3) "moo" } Warning: Compilation failed: unrecognized character after (?< at offset 3 in /in/6c1Bi on line 7 bool(false) array(0) { } Warning: Compilation failed: unrecognized character after (? at offset 2 in /in/6c1Bi on line 10 bool(false) array(0) { }
Output for 4.3.0 - 4.3.2
int(1) array(2) { [0]=> string(3) "moo" [1]=> string(3) "moo" } Warning: Compilation failed: unrecognized character after (?< at offset 3 in /in/6c1Bi on line 7 bool(false) array(0) { } Warning: Compilation failed: unrecognized character after (? at offset 2 in /in/6c1Bi on line 10 bool(false) array(0) { }