3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $input = 'r;anum;l={"5":"10"}'; $output = array(); foreach (explode(';', $input) as $part) { $count = preg_match_all('([a-zA-Z0-9]+)', $part, $matches); $output[] = ($count > 1) ? '[' . implode(',', $matches[0]) . ']' : reset($matches[0]); } print_r($output);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => r [1] => anum [2] => [l,5,10] )