OK, here's a sample array:
$info['user1']['appliance1']='blender';
$info['user1']['appliance2']='toaster';
$info['user1']['appliance3']='oven';
$info['user2']['appliance1']='blender';
$info['user2']['appliance2']='toaster';
$info['user2']['appliance3']='oven';
$info['user3']['appliance1']='blender';
$info['user3']['appliance2']='toaster';
$info['user3']['appliance3']='oven';
suppose I uniformly wanted to change the value of appliance 2 from toaster to microwave. Obviously I can't do:
foreach($info as $n=>$v){//make the change}
because I have varying keys in the first dimension.
What is the most elegant way to change the above array to this:
$info['appliance1']['user1']='blender';
$info['appliance2']['user1']='toaster';
$info['appliance3']['user1']='oven';
$info['appliance1']['user2']='blender';
$info['appliance2']['user2']='toaster';
$info['appliance3']['user2']='oven';
$info['appliance1']['user3']='blender';
$info['appliance2']['user3']='toaster';
$info['appliance3']['user3']='oven';
obviously here I can go:
foreach($info['appliance2'] as $n=>$v){
$info['appliance2'][$n] = 'microwave';
}
So, how to do I flip the index precedence on arrays? I would appreciate some thoughtful explanation as to the underlying concepts, I can take it fromthere.
Thank you ver mucy,
Sam Fullman
Compass Point Media