note 98814 deleted from function.array-change-key-case by danbrown
| From: | danbrown@php.net | Date: | Fri, 09 Jul 2010 12:37:10 +0000 |
| Subject: | note 98814 deleted from function.array-change-key-case by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170813@lists.php.net to get a copy of this message | ||
Note Submitter: AlexRath
----
Just noticing, the post below could have taken use of the Reference Operator (&) in the foreach
Loop:
<?php
interface Cases {
const TO_LOWER = 'mb_strtolower';
const TO_UPPER = 'mb_strtoupper';
}
$func_case = Cases::TO_UPPER;
function change_case_recursive($func_array, $func_case){
foreach($func_array as &$func_value) if(is_array($func_value)) $func_value =
change_case_recursive($func_value); else $func_value = call_user_func($func_case, $func_value);
return $func_array;
}
?>