Doh!  My apologies you're absolutely right.  I just tested it.

-------------
$search = 'bar';
//$myarray = array ('hello' => 'world', 'language' => 'php', 'foo' =>
'bar');
$myarray = array ('world', 'php', 'bar');
$result = array_search($search, $myarray);
echo $result;
-------------

Using the associative array array_search() returns 'foo' and using the
indexed array it returns '2'.  So it works with both array types and does
not require an array starting at index 1.  Live and learn.  :)
-Kevin

----- Original Message -----
From: "Ford, Mike [LSS]" <[EMAIL PROTECTED]>
To: "'Kevin Stone'" <[EMAIL PROTECTED]>; "PHP-general"
<[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 11:12 AM
Subject: RE: [PHP] how to make array_search start from 0?


> > -----Original Message-----
> > From: Kevin Stone [mailto:[EMAIL PROTECTED]]
> > Sent: 25 April 2002 18:02
> >
> > Just looking at the manual here and it explains quite
> > specifically that
> > array_search() is meant to be used with associative arrays,
> > not indexed
> > arrays.
>
> No it doesn't.  How on earth did you read that into it?
>
> 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: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211
>
>



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

Reply via email to