3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php var_dump(preg_match('#/search/(?P<mac>(?:[[:xdigit:]]{2}([-:]))(?:[[:xdigit:]]{2}\2){4}[[:xdigit:]]{2})#', '/search/12-12-12-12-12-12', $matches)); var_dump($matches); var_dump(preg_match('#((?:[[:xdigit:]]{2}([-:]))(?:[[:xdigit:]]{2}\2){4}[[:xdigit:]]{2})#', '12-12-12-12-12-12', $matches)); var_dump($matches); var_dump(preg_match('#(?:[[:xdigit:]]{2}([-:]))(?:[[:xdigit:]]{2}\2){4}[[:xdigit:]]{2}#', '12-12-12-12-12-12', $matches)); var_dump($matches);
Output for 5.2.0 - 5.6.25, 7.0.0 - 7.1.0
int(1) array(4) { [0]=> string(25) "/search/12-12-12-12-12-12" ["mac"]=> string(17) "12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" } int(1) array(3) { [0]=> string(17) "12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" } Warning: preg_match(): Compilation failed: reference to non-existent subpattern at offset 64 in /in/uPbAk on line 10 bool(false) array(3) { [0]=> string(17) "12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" }
Output for hhvm-3.10.0 - 3.12.0
int(1) array(4) { [0]=> string(25) "/search/12-12-12-12-12-12" ["mac"]=> string(17) "12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" } int(1) array(3) { [0]=> string(17) "12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" } Warning: Compilation failed: reference to non-existent subpattern at offset 64 in /in/uPbAk on line 10 bool(false) array(3) { [0]=> string(17) "12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" }
Output for 4.3.11 - 5.1.6
int(1) array(4) { [0]=> string(25) "/search/12-12-12-12-12-12" ["mac"]=> string(17) "12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" } int(1) array(3) { [0]=> string(17) "12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" } Warning: preg_match(): Compilation failed: reference to non-existent subpattern at offset 64 in /in/uPbAk on line 10 bool(false) array(0) { }
Output for 4.3.3 - 4.3.10
int(1) array(4) { [0]=> string(25) "/search/12-12-12-12-12-12" ["mac"]=> string(17) "12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" } int(1) array(3) { [0]=> string(17) "12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" } Warning: Compilation failed: reference to non-existent subpattern at offset 64 in /in/uPbAk on line 10 bool(false) array(0) { }
Output for 4.3.0 - 4.3.2
int(1) array(3) { [0]=> string(25) "/search/12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" } int(1) array(3) { [0]=> string(17) "12-12-12-12-12-12" [1]=> string(17) "12-12-12-12-12-12" [2]=> string(1) "-" } Warning: Compilation failed: reference to non-existent subpattern at offset 64 in /in/uPbAk on line 10 bool(false) array(0) { }