#47276 [NEW]: array_change_value_case
| From: | david at ramaboo dot com | Date: | Mon, 02 Feb 2009 11:26:04 +0000 |
| Subject: | #47276 [NEW]: array_change_value_case | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-133365@lists.php.net to get a copy of this message | ||
From: david at ramaboo dot com
Operating system: all
PHP version: 5.2.8
PHP Bug Type: Feature/Change Request
Bug description: array_change_value_case
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;
}
}
--
Edit bug report at http://bugs.php.net/?id=47276&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47276&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47276&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47276&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47276&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47276&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47276&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47276&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47276&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47276&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47276&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47276&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47276&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47276&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47276&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47276&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47276&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47276&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47276&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47276&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47276&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47276&r=mysqlcfg