note 92355 added to function.array-key-exists

From: Date: Tue, 21 Jul 2009 12:10:01 +0000
Subject: note 92355 added to function.array-key-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-158535@lists.php.net to get a copy of this message
The multi_array_key_exists() function posted by alishahnovin at hotmail dot com ( http://uk3.php.net/manual/en/function.array-key-exists.php#75411 ) does not always return the expected result. This modified version does. <?php /** * multi_array_key_exists function. * * @param mixed $needle The key you want to check for * @param mixed $haystack The array you want to search * @return bool */ function multi_array_key_exists( $needle, $haystack ) { foreach ( $haystack as $key => $value ) : if ( $needle == $key ) return true; if ( is_array( $value ) ) : if ( multi_array_key_exists( $needle, $value ) == true ) return true; else continue; endif; endforeach; return false; } ?> ---- Server IP: 92.48.74.199 Probable Submitter: 195.137.69.93 ---- Manual Page -- http://www.php.net/manual/en/function.array-key-exists.php Edit -- https://master.php.net/note/edit/92355 Del: integrated -- https://master.php.net/note/delete/92355/integrated Del: useless -- https://master.php.net/note/delete/92355/useless Del: bad code -- https://master.php.net/note/delete/92355/bad+code Del: spam -- https://master.php.net/note/delete/92355/spam Del: non-english -- https://master.php.net/note/delete/92355/non-english Del: in docs -- https://master.php.net/note/delete/92355/in+docs Del: other reasons-- https://master.php.net/note/delete/92355 Reject -- https://master.php.net/note/reject/92355 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158535) next »