note 105890 added to function.array-keys
| From: | el dot quick at gmail dot com | Date: | Fri, 23 Sep 2011 15:23:22 +0000 |
| Subject: | note 105890 added to function.array-keys | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183366@lists.php.net to get a copy of this message | ||
Sorry for my english...
I wrote a function to get keys of arrays recursivelly...
function recursive_keys($input, $search_value = null){
$output = ($search_value !== null ? array_keys($input, $search_value) : array_keys($input)) ;
foreach($input as $sub){
if(is_array($sub)){
$output = ($search_value !== null ? array_merge($output, recursive_keys($sub, $search_value)) :
array_merge($output, recursive_keys($sub))) ;
}
}
return $output ;
}
I hope it will be usefull
Regards
----
Server IP: 69.147.83.197
Probable Submitter: 190.86.193.221
----
Manual Page -- http://www.php.net/manual/en/function.array-keys.php
Edit -- https://master.php.net/note/edit/105890
Del: integrated -- https://master.php.net/note/delete/105890/integrated
Del: useless -- https://master.php.net/note/delete/105890/useless
Del: bad code -- https://master.php.net/note/delete/105890/bad+code
Del: spam -- https://master.php.net/note/delete/105890/spam
Del: non-english -- https://master.php.net/note/delete/105890/non-english
Del: in docs -- https://master.php.net/note/delete/105890/in+docs
Del: other reasons-- https://master.php.net/note/delete/105890
Reject -- https://master.php.net/note/reject/105890
Search -- https://master.php.net/manage/user-notes.php