Re: Array question - Finding the name
| From: | Philip Olson | Date: | Fri, 07 Jun 2002 17:51:14 +0000 |
| Subject: | Re: Array question - Finding the name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101152@lists.php.net to get a copy of this message | ||
> I want to find the name of the n-th value in an array. Not the value of
> the n-th, but whatever name was given to it. Array_slice seems to just
> pull part of an array and put it in another. and key() isn't exactly
> what i want either..
Maybe this will help:
> $my_array = array('bob' => $x, 'jim' => $y, 'mike' =>
> $z);
$keys = array_keys($my_array);
print $keys[0]; // bob
print $keys[1]; // jim
Regards,
Philip Olson