note 115594 deleted from function.array-search by crell

From: Date: Thu, 31 Mar 2022 20:40:30 +0000
Subject: note 115594 deleted from function.array-search by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217956@lists.php.net to get a copy of this message
Note Submitter: dk at danilok dot com ---- I needed a way to return the value of a single specific key, thus: <?php function recursive_return_array_value_by_key($needle, $haystack){ $return = false; foreach($haystack as $key => $val){ if(is_array($val)){ $return = recursive_return_array_value_by_key($needle, $val); } else if($needle === $key){ return "$val\n"; } } return $return; } ?>

« previous php.notes (#217956) next »