note 68658 added to function.ucwords
| From: | starmonkey | Date: | Sat, 05 Aug 2006 15:17:43 +0000 |
| Subject: | note 68658 added to function.ucwords | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115569@lists.php.net to get a copy of this message | ||
Simple helper function to walk through a nested array of strings and upper case them:
<?php
/**
* Helper function to convert an array of strings to upper case words
*/
function _capitalize($input) {
if(is_array($input)) {
// recurse through array elements (using a reference)
foreach($input as &$value) {
$value = _capitalize($value);
}
return $input;
} elseif(is_string($input)) {
// process this string
return ucwords($input);
} else {
// all other data types, leave alone
return $input;
}
}
?>
----
Server IP: 66.163.161.117
Probable Submitter: 203.217.45.113
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.ucwords.php
Edit -- https://master.php.net/note/edit/68658
Del: integrated -- https://master.php.net/note/delete/68658/integrated
Del: useless -- https://master.php.net/note/delete/68658/useless
Del: bad code -- https://master.php.net/note/delete/68658/bad+code
Del: spam -- https://master.php.net/note/delete/68658/spam
Del: non-english -- https://master.php.net/note/delete/68658/non-english
Del: in docs -- https://master.php.net/note/delete/68658/in+docs
Del: other reasons-- https://master.php.net/note/delete/68658
Reject -- https://master.php.net/note/reject/68658
Search -- https://master.php.net/manage/user-notes.php