in_array

From: Date: Wed, 20 Oct 1999 17:29:35 +0000
Subject: in_array
Groups: php.version4 
Request: Send a blank email to php-version4+get-5610@lists.php.net to get a copy of this message
Hi, I don't know wether this has been asked before, and wether it has been "added", but I would like in_array to return the cursor for the array that is == the variable you asked for. This would spare a lot of time. Having to do a if(in_array("y",$array)){ for(..){ if($array[$i] == "y"){ unset($array[$i]); } } instead of $arraytest = in_array("y",$array); f($arraytest){ unset($array[$arraytest]); } (Think of an array having 100's even 1000's of keys) As someone in the Online manual put it: you have a haystack; you have a needle you want to find; you ask your buddy in_array if he knows if your needle is in the haystack; he looks in the haystack, turns to you and answers "yes it is" so you look at the haystack which is several miles high, wide, and deep and ask him "where in the haystack ?" and he says ".... you dont need to know, try asking someone else" Regards, David Hjortso.

« previous php.version4 (#5610) next »