Re: PHP 4.0 Bug #9337 Updated: make in_array return key, if searched value was found
| From: | Andrei Zmievski | Date: | Mon, 19 Feb 2001 17:20:16 +0000 |
| Subject: | Re: PHP 4.0 Bug #9337 Updated: make in_array return key, if searched value was found | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-46928@lists.php.net to get a copy of this message | ||
How about using array_keys($array, $value) to find the key?
On Mon, 19 Feb 2001, andre@php.net wrote:
> ID: 9337
> Updated by: andre
> Reported By: sbergmann@php.net
> Old-Status: Open
> Status: Feedback
> Bug Type: Feature/Change Request
> Assigned To:
> Comments:
>
> maybe a fourth parameter switch to avoid 0->false problems?
>
> Previous Comments:
> ---------------------------------------------------------------------------
>
> [2001-02-19 11:18:18] sbergmann@php.net
> in_array() currently returns only true/false on whether or not a searched-for value is in a
> given array.
>
> I would like it to return the key of the array's element when value was found, and false
> otherwise. This should not break existing code using in_array().
>
>
> ---------------------------------------------------------------------------
>
>
>
> ATTENTION! Do NOT reply to this email!
> To reply, use the web interface found at
> http://bugs.php.net/?id=9337&edit=2
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
-Andrei
Complexity in the mind is not caused by learning;
learning is caused by complexity in the mind.
-- Steven Pinker