3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = "Ala ma 2 koty, Adam ma 4 psy"; preg_match_all("/(?P&lt;kto&gt;[A-Z]\w+)\s\w+\s(?P&lt;ile&gt;\d+)/", $str, $matches); print $matches[0][0] . "\n"; print $matches[0][1] . "\n"; print $matches[1][0] . "\n"; print $matches[1][1] . "\n";
based on jKWuZ
Output for 5.2.0 - 7.2.0
Warning: preg_match_all(): Compilation failed: unrecognized character after (?P at offset 3 in /in/VHEQ0 on line 4
Output for 4.3.11 - 5.1.6
Warning: preg_match_all(): Compilation failed: unrecognized character after (?P at offset 3 in /in/VHEQ0 on line 4 Notice: Undefined offset: 0 in /in/VHEQ0 on line 5 Notice: Undefined offset: 0 in /in/VHEQ0 on line 6 Notice: Undefined offset: 1 in /in/VHEQ0 on line 7 Notice: Undefined offset: 1 in /in/VHEQ0 on line 8
Output for 4.3.0 - 4.3.10
Warning: Compilation failed: unrecognized character after (?P at offset 3 in /in/VHEQ0 on line 4 Notice: Undefined offset: 0 in /in/VHEQ0 on line 5 Notice: Undefined offset: 0 in /in/VHEQ0 on line 6 Notice: Undefined offset: 1 in /in/VHEQ0 on line 7 Notice: Undefined offset: 1 in /in/VHEQ0 on line 8