note 89733 deleted from function.array-change-key-case by danbrown
| From: | danbrown@php.net | Date: | Fri, 20 Mar 2009 19:42:48 +0000 |
| Subject: | note 89733 deleted from function.array-change-key-case by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152223@lists.php.net to get a copy of this message | ||
Note Submitter: maik at phpkuh dot de
----
@ david at ramaboo:
This would be a great addition!
Also for now there are some faster work arounds.
First if the array has unique values it would be about 30% faster to:
<?php
$arr= array_flip($arr);
$arr= array_change_key_case($arr, $case);
$arr= array_flip($arr);
?>
Or what does perform nearly as good as flipping but does not suffer from value restriction:
<?php
foreach($arr as $key->$value) {
$arr[$key] = strtolower($value);
}
?>
performance on my PPC G4 at 1.3 GHz using PHP 5.3:
array_flip: 100%
foreach: 109%
array_walk: 153%
tested with 50 values 100 000 times each.