Given original codes as:
foreach($option as $name=>$value)
$array[$name] = $value;
and $name as
button[0][text], button[0][value], button[1][text], spider[0][name], ...
The result array would be
array('button[0][text]' => 'its text',
'button[0][value]' => 'its value',
'button[1][text]' => 'its text',
'spider[0][name]' => 'its name',
)
However, what i want is
array('button' => array( array('text'=>'its text', 'value'=>'its value'), // this is $array[button][0]
array('text'=>'its text') // this is $array[button][1]
),
'spider' => array( array('name'=>'its name') // this is $array[spider][0]
)
)
How could i do this? ...