note 89733 added to function.array-change-key-case
| From: | maik at phpkuh dot de | Date: | Fri, 20 Mar 2009 19:29:58 +0000 |
| Subject: | note 89733 added to function.array-change-key-case | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152221@lists.php.net to get a copy of this message | ||
@ 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.
----
Server IP: 194.153.94.10
Probable Submitter: 85.1.28.176
----
Manual Page -- http://www.php.net/manual/en/function.array-change-key-case.php
Edit -- https://master.php.net/note/edit/89733
Del: integrated -- https://master.php.net/note/delete/89733/integrated
Del: useless -- https://master.php.net/note/delete/89733/useless
Del: bad code -- https://master.php.net/note/delete/89733/bad+code
Del: spam -- https://master.php.net/note/delete/89733/spam
Del: non-english -- https://master.php.net/note/delete/89733/non-english
Del: in docs -- https://master.php.net/note/delete/89733/in+docs
Del: other reasons-- https://master.php.net/note/delete/89733
Reject -- https://master.php.net/note/reject/89733
Search -- https://master.php.net/manage/user-notes.php