Re: how to make array_search start from 0?
| From: | Kevin Stone | Date: | Thu, 25 Apr 2002 17:02:01 +0000 |
| Subject: | Re: how to make array_search start from 0? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94582@lists.php.net to get a copy of this message | ||
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. I think the best way to do what you want is to do is to set up a
loop and test each index against eregi(); If true then you know your index.
-Kevin
----- Original Message -----
From: "andy" <news.letters@gmx.de>
To: <php-general@lists.php.net>
Sent: Thursday, April 25, 2002 10:30 AM
Subject: [PHP] how to make array_search start from 0?
> Hi there,
>
> I am passing an array through the URL with a ',' inbetween:
> var=php,mysql,super
> Parsing is done with: explode (',',$var). This gives me an array starting
> with 0
>
> Later on I have to search for lets say php with array_search.
>
> Unfortunatelly array_search requires an array starting with 1. So php is
not
> found.
>
> Does anybody know a workaround for this?
>
> Thanx,
>
> Andy
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>