3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $prices = array( "Red Pants" => 20, "Black Hats" => 15); $items = "8 Red Pants, 2 Shirts, 6 Black Hats"; preg_match_all("/(?:(\d+) ([\w ])+,?)+/", $items, $matches); print_r($matches);
based on 99RoS
Output for 5.3.19 - 7.2.0
Array ( [0] => Array ( [0] => 8 Red Pants, [1] => 2 Shirts, [2] => 6 Black Hats ) [1] => Array ( [0] => 8 [1] => 2 [2] => 6 ) [2] => Array ( [0] => s [1] => s [2] => s ) )