note 105249 added to function.ucwords
| From: | SebstianEspinosa at osu1 dot php dot net | Date: | Thu, 04 Aug 2011 23:16:26 +0000 |
| Subject: | note 105249 added to function.ucwords | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182239@lists.php.net to get a copy of this message | ||
Is more simple to use str_replace to use ucwords without using space as separator like:
<?php
function ucwordsEx($str, $separator){
$str = str_replace($separator, " ", $str);
$str = ucwords(strtolower($str));
$str = str_replace(" ", $separator, $str);
return $str;
}
/*
Example:
*/
echo ucwordsEx("HELLO-my-NAME-iS-maNolO", "-");
/*
Prints: "Hello My Name Is Manolo"
*/
?>
----
Server IP: 69.147.83.197
Probable Submitter: 200.71.194.210
----
Manual Page -- http://www.php.net/manual/en/function.ucwords.php
Edit -- https://master.php.net/note/edit/105249
Del: integrated -- https://master.php.net/note/delete/105249/integrated
Del: useless -- https://master.php.net/note/delete/105249/useless
Del: bad code -- https://master.php.net/note/delete/105249/bad+code
Del: spam -- https://master.php.net/note/delete/105249/spam
Del: non-english -- https://master.php.net/note/delete/105249/non-english
Del: in docs -- https://master.php.net/note/delete/105249/in+docs
Del: other reasons-- https://master.php.net/note/delete/105249
Reject -- https://master.php.net/note/reject/105249
Search -- https://master.php.net/manage/user-notes.php