Re: array search in 2-D arrays

From: Date: Wed, 15 May 2002 18:38:21 +0000
Subject: Re: array search in 2-D arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-97771@lists.php.net to get a copy of this message
Oops! Sorry I got a reply for this but didn't read my mail carefully enough. Thanks to Tim Ward for pointing out the problem. > I've a 2 D array and would like to search for vals. in the first dimension > only i.e. > myArray[0][0] > myArray[1][0] > myArray[2][0] > myArray[3][0] > . > . > . > and not in the elements myArray[0][1].... > > CODE: > for($l = 0; $l < count($layer); $l++) { > $key = array_search($layer[$l], $layerDes); // $layerDes is 2-D > $layer[$l] = $layerNames[$key]; > } > My $key is FALSE/0 after execution, is it because the elements are in > $layerDes[i][0]? > Using $key === also didn't help? Any ideas, thanks. > > > -Pushkar S. Pradhan > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -Pushkar S. Pradhan

« previous php.general (#97771) next »