|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-02-02 14:21 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 17 22:00:01 2025 UTC |
Description: ------------ There is a function array_change_key_case but not array_change_value_case. This should be part of the language. Something like this: /** * @brief Returns an array with all values lowercased or uppercased. * @return array Returns an array with all values lowercased or uppercased. * @param object $input The array to work on * @param int $case [optional] Either \c CASE_UPPER or \c CASE_LOWER (default). */ function array_change_value_case(array $input, $case = CASE_LOWER) { switch ($case) { case CASE_LOWER: return array_map('strtolower', $input); break; case CASE_UPPER: return array_map('strtoupper', $input); break; default: trigger_error('Case is not valid, CASE_LOWER or CASE_UPPER only', E_USER_ERROR); return false; } }