Please see my code bellow, I want to get $arr['jimmy']['age'] here. The string is jimmy.age which will be posted from ajax
<?php
$arr=array(
'jimmy'=>array(
'age'=>31
)
);
$str='jimmy.age';
$keys_tree=explode('.',$str);
$x='';
foreach($keys_tree as $k=>$v){
$x.='["'.$v.'"]';
}
echo $arr$x; //error here; how can i get $arr['jimmy']['age'] using $arr joining str ['jimmy']['age']
$arr$xmeans, please. If, while you try to do so, you realise what you did wrong, there is no shame in removing this question.$xcontains a string which looks like array notation.$arr.$x.eval(), but there's too much drama attached to that function