Re: PHP 4.0 Bug #9337 Updated: make in_array return key, if searched value was found

From: Date: Mon, 19 Feb 2001 17:32:01 +0000
Subject: Re: PHP 4.0 Bug #9337 Updated: make in_array return key, if searched value was found
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-46930@lists.php.net to get a copy of this message
How about using array_keys($array, $value) to find the key?
obviously it is cheaper to let in_array return it and it is more php 4 stylish, we have booleans, why not use them? if ($key=in_array()) do_someting_with_key($key); is less expensive than if (in_array()) { $key=array_keys($array,$value); do_something_with_key($key); } -- · André Langhorst t: +49 331 5811560 · · andre@php.net m: +49 173 9558736 · * PHP Quality Assurance http://qa.php.net *

« previous php.dev (#46930) next »