test for multi-dim array
| From: | John Pillion | Date: | Thu, 16 Aug 2007 15:48:00 +0000 |
| Subject: | test for multi-dim array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-260923@lists.php.net to get a copy of this message | ||
I'm trying to recursively loop through a multi dimensional array with
unknown keys and unknown values, and echo the keys/values to a sql
statement, where the key is the field, and the value is the. value.
What I want to do is test an array index to see if it has any children
indices (which then need to be looped through again), or if it is the lowest
level child. in which case, the data needs to be extracted.
What is the easiest way to test an array index to see if it has one or more
children? Just doing a count() isn't reliable, as their may only be a single
parent on the highest level.
John