RE: [PHP] traverse a multidimensional array
| From: | Boget, Chris | Date: | Thu, 20 Jul 2000 14:28:52 +0000 |
| Subject: | RE: [PHP] traverse a multidimensional array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7422@lists.php.net to get a copy of this message | ||
> OK, thanks, Chris, good of you to answer - a classic case of
> RTFM from me there!
Been there. :)
> It occurred to me though, is there a way to recurse through
> the structure if the dimensions are not known?
count() is a good way. If you are using that loop where some
of the values are arrays and some are not, you can just check
the type of $value and if it is an array, loop through that as
well. The best solution for something like this is a recursive
function.
Chris