note 87367 added to function.array-change-key-case
| From: | anon at ymous dot com | Date: | Tue, 02 Dec 2008 11:19:00 +0000 |
| Subject: | note 87367 added to function.array-change-key-case | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-147512@lists.php.net to get a copy of this message | ||
Below is a recursive version of this function.
/**
* A recursive array_change_key_case function.
* @param array $input
* @param integer $case
*/
function array_change_key_case_recursive($input, $case = null){
if(!is_array($input)){
trigger_error("Invalid input array '{$array}'",E_USER_NOTICE); exit;
}
// CASE_UPPER|CASE_LOWER
if(null === $case){
$case = CASE_LOWER;
}
if(!in_array($case, array(CASE_UPPER, CASE_LOWER))){
trigger_error("Case parameter '{$case}' is invalid.", E_USER_NOTICE); exit;
}
$input = array_change_key_case($input, $case);
foreach($input as $key=>$array){
if(is_array($array)){
$input[$key] = array_change_key_case_recursive($array, $case);
}
}
return $input;
}
----
Server IP: 87.124.35.190
Probable Submitter: 78.105.7.254
----
Manual Page -- http://www.php.net/manual/en/function.array-change-key-case.php
Edit -- https://master.php.net/note/edit/87367
Del: integrated -- https://master.php.net/note/delete/87367/integrated
Del: useless -- https://master.php.net/note/delete/87367/useless
Del: bad code -- https://master.php.net/note/delete/87367/bad+code
Del: spam -- https://master.php.net/note/delete/87367/spam
Del: non-english -- https://master.php.net/note/delete/87367/non-english
Del: in docs -- https://master.php.net/note/delete/87367/in+docs
Del: other reasons-- https://master.php.net/note/delete/87367
Reject -- https://master.php.net/note/reject/87367
Search -- https://master.php.net/manage/user-notes.php