RE: [PHP] Position in array

From: Date: Fri, 11 Apr 2003 11:17:28 +0000
Subject: RE: [PHP] Position in array
Groups: php.general 
Request: Send a blank email to php-general+get-143477@lists.php.net to get a copy of this message
> -----Original Message----- > From: Uma Shankari T. [mailto:umashankari@lantana.tenet.res.in] > Sent: 11 April 2003 11:52 > > It is returing only the no strings getting matched not the > position of the > matched string.. It returns the key of the matched element: $test = array('cat', 'dog', 'hutch'=>'rabbit', 'tank'=>'goldfish', 'cage'=>'budgie', 'goat'); echo array_search('goat', $test); // returns 2 echo array_search('goldfish', $test); // returns 'tank' Isn't this what you wanted? If not, please expand or reformulate your question. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#143477) next »