|
Posted by "Alan Lord" on 10/13/05 21:52
Hi TG and others,
I think I must be missing something here.
Your example doesn't seem to traverse "down" into a multidim array.
Also, it appears as though your script assumes that the structure of the
array is known. It isn't and it is retrieved from "far away" and I have
no control over it's structure/depth/size etc... I can take a good guess
at the keys I want to keep and keep those in an array in my config.inc.
But I would ideally like to be able to have a function which is as
"array agnostic" as possible.
I tried to do an "unset($arr[key])" in one of my other attempts at
solving this problem. But from what I read in the manual (if I
understood correctly :-)), it seems as though you can't really do this
from within a function/routine which is walking through the array at
that time as the array is not re-ordered...
Thanks and no offence intended, I am just trying to understand... :-)
Alan
--
Tg wrote:
That works just as well, if you have only two levels of depth. Mostly I
was trying to illustrate how to use $key => $value in a foreach and what
to do if you need to go multiple levels down. Once you get to the
bottom level, then you can use isset() certainly.
Just wanted to make sure that it was clear what to do with $key and
$subkey relating to the main array ($alldataarr in this example)
---------snip-----------------
Navigation:
[Reply to this message]
|