3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = <<<FOO a: 1 b: 2 c: 3 FOO; preg_match_all('/(?P<name>\w+): (?P<digit>\d+)/', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); print_r($matches); preg_match_all('/(?P<name>\w+): (?P<digit>\d+)/', $str, $matches, PREG_SET_ORDER); print_r($matches);
Output for 4.3.3 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => Array ( [0] => Array ( [0] => a: 1 [1] => 0 ) [name] => Array ( [0] => a [1] => 0 ) [1] => Array ( [0] => a [1] => 0 ) [digit] => Array ( [0] => 1 [1] => 3 ) [2] => Array ( [0] => 1 [1] => 3 ) ) [1] => Array ( [0] => Array ( [0] => b: 2 [1] => 5 ) [name] => Array ( [0] => b [1] => 5 ) [1] => Array ( [0] => b [1] => 5 ) [digit] => Array ( [0] => 2 [1] => 8 ) [2] => Array ( [0] => 2 [1] => 8 ) ) [2] => Array ( [0] => Array ( [0] => c: 3 [1] => 10 ) [name] => Array ( [0] => c [1] => 10 ) [1] => Array ( [0] => c [1] => 10 ) [digit] => Array ( [0] => 3 [1] => 13 ) [2] => Array ( [0] => 3 [1] => 13 ) ) ) Array ( [0] => Array ( [0] => a: 1 [name] => a [1] => a [digit] => 1 [2] => 1 ) [1] => Array ( [0] => b: 2 [name] => b [1] => b [digit] => 2 [2] => 2 ) [2] => Array ( [0] => c: 3 [name] => c [1] => c [digit] => 3 [2] => 3 ) )
Output for 4.3.0 - 4.3.2
Array ( [0] => Array ( [0] => Array ( [0] => a: 1 [1] => 0 ) [1] => Array ( [0] => a [1] => 0 ) [2] => Array ( [0] => 1 [1] => 3 ) ) [1] => Array ( [0] => Array ( [0] => b: 2 [1] => 5 ) [1] => Array ( [0] => b [1] => 5 ) [2] => Array ( [0] => 2 [1] => 8 ) ) [2] => Array ( [0] => Array ( [0] => c: 3 [1] => 10 ) [1] => Array ( [0] => c [1] => 10 ) [2] => Array ( [0] => 3 [1] => 13 ) ) ) Array ( [0] => Array ( [0] => a: 1 [1] => a [2] => 1 ) [1] => Array ( [0] => b: 2 [1] => b [2] => 2 ) [2] => Array ( [0] => c: 3 [1] => c [2] => 3 ) )