note 49248 deleted from function.array-search by felipe

From: Date: Sun, 10 Feb 2008 13:09:59 +0000
Subject: note 49248 deleted from function.array-search by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-135954@lists.php.net to get a copy of this message
Note Submitter: hanafi at pixella dot com ---- If you want to search in a multi-dimensional array and just a portion, not the whole value, try this. <? $Projects[0] = array(123, "Text 1"); $Projects[1] = array(456, "Text 2"); $Projects[2] = array(789, "Text 3"); $search_value = "ext 2"; foreach ($Projects as $key => $row) { foreach($row as $cell) { if (strpos($cell, $search_value) !== FALSE) { echo "<p>".$key; } } } ?>

« previous php.notes (#135954) next »