note 48731 added to function.array-search

From: Date: Wed, 05 Jan 2005 15:54:35 +0000
Subject: note 48731 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-82791@lists.php.net to get a copy of this message
Not to labour the point too much, but here's another, slightly less verbose multi dimensional recursive function... function array_key_exists_recursive($needle,$haystack) { foreach($haystack as $key=>$val) { if(is_array($val)) { if(array_key_exists_recursive($needle,$val)) return 1; } elseif($val == $needle) return 1; } return 0; } ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48731 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48731&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48731&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48731&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48731&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48731&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48731&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48731&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#82791) next »