Re: Re: How to display all keys in a multi-dim array?
| From: | Torsten Roehr | Date: | Sun, 23 May 2004 17:53:58 +0000 |
| Subject: | Re: Re: How to display all keys in a multi-dim array? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186804@lists.php.net to get a copy of this message | ||
"Richard Davey" <rich@launchcode.co.uk> wrote in message
news:1197479794.20040523184642@launchcode.co.uk...
> Hello Torsten,
>
> Sunday, May 23, 2004, 6:44:08 PM, you wrote:
>
> >> $array = array();
> >> $array['a'] = "1";
> >> $array['a']['b'] = "2";
> >> $array['a']['b']['c'] = "3";
> >> $array['a']['b']['c']['d'] = "4";
>
> TR> Could you describe a bit more in detail what you mean with "based on
search
> TR> result for 4"?
>
> I know that 4 is a *unique value* in my multi-dim array, but I do not
> know the key names that exist under-neath it because they were created
> dynamically. In other words - how do I find out all of the keys that
> hold the value 4?
So you basically want to search for the value and get its key(s), right?
Take a look at array_search():
http://de.php.net/manual/en/function.array-search.php
There are also some user comments on multi-dim arrays that might help you.
Hope this helps,
Regards,
Torsten