3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = <<<FOO a: 1 b: 2 c: 3 FOO; preg_match_all('/(\w+): (\d+)/', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); print_r($matches); preg_match_all('/(\w+): (\d+)/', $str, $matches, PREG_SET_ORDER); print_r($matches);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
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 ) )