With the following bit of code I'm trying to get the key's of each sub-array that I will need at this part of the script. It's working so I'm not too worried about this, I just think there should be a pre-built function to do the same thing.
foreach($myArray['ico'] as $k => $v) {
if(count($v) == 2) {
$kidsKey = $k;
}
if($v['type'] == 'bags') {
$luggKey = $k;
}
}
How would you guys go about doing this? My only concern is that the array may grow with time and I'm wasting memory just to get 2 keys at this point.
For academic purposes, lets belive I have no control over the array creation so changing the key at the start isn't an option.