note 66791 rejected from function.array-key-exists by techtonik

From: Date: Thu, 07 Dec 2006 08:33:44 +0000
Subject: note 66791 rejected from function.array-key-exists by techtonik
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-120363@lists.php.net to get a copy of this message
Note Submitter: josh at nitrotech dot org ---- 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)

« previous php.notes (#120363) next »