note 66791 added to function.array-key-exists

From: Date: Mon, 29 May 2006 13:24:00 +0000
Subject: note 66791 added to function.array-key-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-112497@lists.php.net to get a copy of this message
Here is a simple method for searching nested arrays. <?php function in_array_multi_key($needle, $haystack) { // mutidimentional search for in_array function // only matches the key, values don't count. if ( array_key_exists($needle, $haystack) ) { return TRUE; } foreach ( $haystack as $key => $value ) { if ( is_array($value) ) { $work = in_array_multi_key($needle, $value); if ( $work ) { return TRUE; } } } return FALSE; } ?> (Code from www.nitrotech.org) ---- Server IP: 203.220.0.234 Probable Submitter: 58.169.93.234 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.array-key-exists.php Edit -- http://master.php.net/note/edit/66791 Del: integrated -- http://master.php.net/note/delete/66791/integrated Del: useless -- http://master.php.net/note/delete/66791/useless Del: bad code -- http://master.php.net/note/delete/66791/bad+code Del: spam -- http://master.php.net/note/delete/66791/spam Del: non-english -- http://master.php.net/note/delete/66791/non-english Del: in docs -- http://master.php.net/note/delete/66791/in+docs Del: other reasons-- http://master.php.net/note/delete/66791 Reject -- http://master.php.net/note/reject/66791 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#112497) next »