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);
Output for 5.2.2 - 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) "-" } Warning: preg_match(): Compilation failed: unmatched parentheses at offset 64 in /in/MoriV on line 6 bool(false) 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) "-" }
Output for 5.2.0 - 5.2.1
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) "-" } Warning: preg_match(): Compilation failed: reference to non-existent subpattern at offset 64 in /in/MoriV on line 6 bool(false) 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) "-" }
Output for 4.3.11 - 4.4.5, 5.0.0 - 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) "-" } Warning: preg_match(): Compilation failed: reference to non-existent subpattern at offset 64 in /in/MoriV on line 6 bool(false) array(0) { }
Output for 4.4.6 - 4.4.9
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) "-" } Warning: preg_match(): Compilation failed: unmatched parentheses at offset 64 in /in/MoriV on line 6 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) "-" } Warning: Compilation failed: reference to non-existent subpattern at offset 64 in /in/MoriV on line 6 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) "-" } Warning: Compilation failed: reference to non-existent subpattern at offset 64 in /in/MoriV on line 6 bool(false) array(0) { }