Hi,
I would like to know if anybody has a good solution for working through a multidimensional array and retrieving information for just one of the keys. For example I have an array that is built like this
for ($i=0;$i<5;$i++){
$array[$cnt]['x'] = $i;
$array[$cnt]['y'] = $i;
$array[$cnt]['z'] = $i;
}
essentially I am not worried about the data in the array just want to be able to do something when I iterate through the array only when I am at index $array[$cnt]['x'];
foreach( $array as $key => $value){
foreach ($value as $k){
??how do I reference value $i at only the x
}
}
is there a array method to test whether I have got the x component? I have tried to use the $value parameter but it gives me an array
Any ideas?
I would like to know if anybody has a good solution for working through a multidimensional array and retrieving information for just one of the keys. For example I have an array that is built like this
for ($i=0;$i<5;$i++){
$array[$cnt]['x'] = $i;
$array[$cnt]['y'] = $i;
$array[$cnt]['z'] = $i;
}
essentially I am not worried about the data in the array just want to be able to do something when I iterate through the array only when I am at index $array[$cnt]['x'];
foreach( $array as $key => $value){
foreach ($value as $k){
??how do I reference value $i at only the x
}
}
is there a array method to test whether I have got the x component? I have tried to use the $value parameter but it gives me an array
Any ideas?