- reset: documentation ( source)
- print_r: documentation ( source)
- preg_match_all: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
<?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);