note 112356 added to function.ucwords
| From: | ATOLYE15 | Date: | Thu, 06 Jun 2013 09:11:40 +0000 |
| Subject: | note 112356 added to function.ucwords | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195090@lists.php.net to get a copy of this message | ||
This solution is a proper use of capitalize first letters of "TURKISH" sentence by
ATÃLYE15 crew.
function ucwordstr($sentence)
{
$letters =
array('I','İ','Ã','Å','Ã','Ã','Ä');
$replace =
array('ı','i','ç','Å','ü','ö','Ä');
$sentence = mb_strtolower(str_replace($letters,$replace,$sentence),"UTF-8");
$words = array();
foreach(explode(" ",$sentence) as $word)
{
$first = str_replace($replace,$letters,mb_substr($word, 0, 1, "UTF-8"));
$other = mb_substr($word,1,strlen($word)-1,"UTF-8");
$words[] = $first.$other;
}
$sentence = implode(" ",$words);
return ucwords($sentence);
}
----
Server IP: 69.147.83.199
Probable Submitter: 88.243.76.102
----
Manual Page -- http://php.net/manual/en/function.ucwords.php
Edit -- https://master.php.net/note/edit/112356
Del: integrated -- https://master.php.net/note/delete/112356/integrated
Del: useless -- https://master.php.net/note/delete/112356/useless
Del: bad code -- https://master.php.net/note/delete/112356/bad+code
Del: spam -- https://master.php.net/note/delete/112356/spam
Del: non-english -- https://master.php.net/note/delete/112356/non-english
Del: in docs -- https://master.php.net/note/delete/112356/in+docs
Del: other reasons-- https://master.php.net/note/delete/112356
Reject -- https://master.php.net/note/reject/112356
Search -- https://master.php.net/manage/user-notes.php