note 29436 added to function.array-search

From: Date: Thu, 13 Feb 2003 14:13:27 +0000
Subject: note 29436 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-43883@lists.php.net to get a copy of this message
If you wanna find a value in multidimensional array with array_search. You should do the following: Use For-Each, that it solves your Problem! Example: $map = array( array( Name=>'Jordan' ), array( Name=>'Oneal' ) ); $search_value = "Jordan"; foreach ($map as $key => $row) { foreach($row as $cell) { if ($cell == $search_value) print $key; } } -- http://www.php.net/manual/en/function.array-search.php http://master.php.net/manage/user-notes.php?action=edit+29436 http://master.php.net/manage/user-notes.php?action=delete+29436 http://master.php.net/manage/user-notes.php?action=reject+29436

« previous php.notes (#43883) next »