3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo preg_match('/(\w+) (\w+)/', 'rodrigo capile', $m); var_dump($m); echo preg_match('/(\w+) (\w+)/', 'rodrigo capile rodrigo capile rodrigo capile', $m); var_dump($m); echo preg_match_all('/(\w+) (\w+)/', 'rodrigo capile rodrigo capile rodrigo capile', $m); var_dump($m);
based on IaqMX
Output for 4.3.0 - 7.2.0
1array(3) { [0]=> string(14) "rodrigo capile" [1]=> string(7) "rodrigo" [2]=> string(6) "capile" } 1array(3) { [0]=> string(14) "rodrigo capile" [1]=> string(7) "rodrigo" [2]=> string(6) "capile" } 3array(3) { [0]=> array(3) { [0]=> string(14) "rodrigo capile" [1]=> string(14) "rodrigo capile" [2]=> string(14) "rodrigo capile" } [1]=> array(3) { [0]=> string(7) "rodrigo" [1]=> string(7) "rodrigo" [2]=> string(7) "rodrigo" } [2]=> array(3) { [0]=> string(6) "capile" [1]=> string(6) "capile" [2]=> string(6) "capile" } }