- print_r: documentation ( source)
- preg_match_all: documentation ( source)
- explode: documentation ( source)
- trim: documentation ( source)
<?php
$string = '(Mary Poppens) Umbrella (Color Yellow)';
preg_match_all('#\((.*?)\)|[^()]+#', $string, $match, PREG_SET_ORDER);
foreach($match as $m){
if(isset($m[1])){
$array[] = explode(' ', $m[1]);
}else{
$array[] = trim($m[0]);
}
}
print_r($array);
?>