3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // just do this... $matches = array(); preg_match_all('/\s(:\w+)/', 'jhkjh :fgfgfgfg :fgfg : : ffgg', $matches); print_r($matches); // we could wrap it in a function that eliminates the pass by reference, and/or use Flux (https://github.com/selvinortiz/flux) and extend it $matches = array(); preg_match_all('/\s(:\w+)/', 'jhkjh :fgfgfgfg :fgfg : : ffgg', $matches, PREG_SET_ORDER); print_r($matches);
based on Jlaf6
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
Array ( [0] => Array ( [0] => :fgfgfgfg [1] => :fgfg ) [1] => Array ( [0] => :fgfgfgfg [1] => :fgfg ) ) Array ( [0] => Array ( [0] => :fgfgfgfg [1] => :fgfgfgfg ) [1] => Array ( [0] => :fgfg [1] => :fgfg ) )