3v4l.org

run code in 300+ PHP versions simultaneously
<?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";

preferences:
30.32 ms | 402 KiB | 5 Q