Hello,
If there’s an array such as:
[CODE]
$arr=array(
‘key1’=>array(
‘key1a’=>array(…),
‘key1b’=>array(…)
)
);
and, since ‘key1’, ‘key1b’, etc may be any number of keys, I want to find out if $arr[‘key1’][‘key1b’] exists using a function like:
[CODE]
function updateArr($keys, $val){
global $arr;
//check if $arr[$k1][$k2][$k3] exists
//update $arr[$k1][$k2][$k3] equal to $val
}
updateArr(array($k1,$k2,$k3,…),’myVal’);//call that function to update the array
How should I go about doing that? For example, should I use something like “foreach($keys as $key)” and use a reference to $arr (&$arr, for example)? If so, how would I reference it? Or is there something easier to use for this?
Thanks in advance.