note 80753 deleted from function.array-change-key-case by sobak
| From: | sobak@php.net | Date: | Fri, 25 Nov 2016 07:38:59 +0000 |
| Subject: | note 80753 deleted from function.array-change-key-case by sobak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-207671@lists.php.net to get a copy of this message | ||
Note Submitter: dot dot dot dot dot alexander at gmail dot com
----
Basically this is the function if your version is lower than 4.2.0
<?php
if ( !defined('CASE_LOWER') )define('CASE_LOWER', 0);
if ( !defined('CASE_UPPER') )define('CASE_UPPER', 1);
if(!function_exists("array_change_key_case")){
function array_change_key_case($input, $case=0){
if(!is_array($input))return FALSE;
$product = array();
foreach($input as $key => $value){
if($case){ //Upper
$key2 = ( (is_string($key)) ? (strtoupper($key)) : ($key) );
$product[$key2] = $value;
}
else{ //Lower
$key2 = ( (is_string($key)) ? (strtolower($key)) : ($key) );
$product[$key2] = $value;
}
}
return $product;
}/* endfunction array_change_key_case */
}/* endfunction exists array_change_key_case*/
?>