note 43495 rejected from function.array-change-key-case by aidan

From: Date: Sat, 03 Jul 2004 15:26:24 +0000
Subject: note 43495 rejected from function.array-change-key-case by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72477@lists.php.net to get a copy of this message
Note Submitter: Adam Jacob Muller <adam@gotlinux.us> ---- I am running PHP 4.1.2 so array_change_key_case isn't avaliable. I know it's avaliable in PHP_Compat but it's much more fun to write it yourself. You might have to define CASE_UPPER and CASE_LOWER define("CASE_UPPER",1); define("CASE_LOWER",0); I wonder if it's possible to make this code faster... function array_change_key_case($array,$case=CASE_LOWER) { if ($case=CASE_LOWER) $cmd=strtolower; elseif ($case=CASE_UPPER) $cmd=strtoupper; foreach($array as $key=>$value) { $output[$cmd($key)]=$value; } return $output; }

« previous php.notes (#72477) next »