note 115594 added to function.array-search

From: Date: Thu, 21 Aug 2014 18:26:24 +0000
Subject: note 115594 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-200238@lists.php.net to get a copy of this message
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; } ?> ---- Server IP: 72.52.91.14 Probable Submitter: 50.198.252.141 ---- Manual Page -- http://php.net/manual/en/function.array-search.php Edit -- https://master.php.net/note/edit/115594 Del: integrated -- https://master.php.net/note/delete/115594/integrated Del: useless -- https://master.php.net/note/delete/115594/useless Del: bad code -- https://master.php.net/note/delete/115594/bad+code Del: spam -- https://master.php.net/note/delete/115594/spam Del: non-english -- https://master.php.net/note/delete/115594/non-english Del: in docs -- https://master.php.net/note/delete/115594/in+docs Del: other reasons-- https://master.php.net/note/delete/115594 Reject -- https://master.php.net/note/reject/115594 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200238) next »