On Friday 07 June 2002 22:16, Phil Schwarzmann wrote:
> Let's say I have an array...
> $my_array[] = array('bob' => $x,  'jim' => $y, 'mike' => $z);

you probably meant to define it as:

$my_array = array('bob' => $x,  'jim' => $y, 'mike' => $z);

use print_r($my_array) to see the difference between your definition and mine.

> Now I want to find the name of the second element in the array (I want
> my result to be 'jim')

> How do I do this?  I think I might have to use the key() function but I
> can't quite get it to wkr.

Depends on whether you want to find the name of the 'n-th' element, or the 
name of the element whose value is '$y'.

If the former you can use array_slice(), the latter key().

Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

ATM cell has no roaming feature turned on, notebooks can't connect

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to