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 5.2.6 - 5.6.28, 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 ) ) ) Warning: preg_match_all(): Compilation failed: unrecognized character after (? or (?- at offset 9 in /in/SiscR on line 13 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 ) ) )
Output for hhvm-3.10.0 - 3.12.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 ) ) ) Warning: Compilation failed: unrecognized character after (? or (?- at offset 9 in /in/SiscR on line 13 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 ) ) )
Output for 5.2.0 - 5.2.5
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 ) ) ) Warning: preg_match_all(): Compilation failed: unrecognized character after (? at offset 9 in /in/SiscR on line 13 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 ) ) )
Output for 4.3.11 - 4.4.1, 4.4.3 - 4.4.8, 5.0.0 - 5.1.1, 5.1.3 - 5.1.6
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 ) ) ) Warning: preg_match_all(): Compilation failed: unrecognized character after (? at offset 9 in /in/SiscR on line 13 Array ( )
Output for 4.4.2, 5.1.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 ) ) ) Warning: preg_match_all(): Compilation failed: unrecognized character after (? at offset 9 in /in/SiscR on line 14 Array ( )
Output for 4.4.9
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 ) ) ) Warning: preg_match_all(): Compilation failed: unrecognized character after (? or (?- at offset 9 in /in/SiscR on line 13 Array ( )
Output for 4.3.0 - 4.3.10
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 ) ) ) Warning: Compilation failed: unrecognized character after (? at offset 9 in /in/SiscR on line 13 Array ( )