3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $pattern = '#^(?:(?:/(?P<peekaboo>[^/\.,;?\n]+))?/(?P<action>[^/\.,;?\n]+))?$#'; if (preg_match($pattern, '/foo/bar', $matches)) { var_dump( $matches); }
Output for 4.3.3 - 7.1.0
array(5) { [0]=> string(8) "/foo/bar" ["peekaboo"]=> string(3) "foo" [1]=> string(3) "foo" ["action"]=> string(3) "bar" [2]=> string(3) "bar" }
Output for 4.3.0 - 4.3.2
array(3) { [0]=> string(8) "/foo/bar" [1]=> string(3) "foo" [2]=> string(3) "bar" }