note 113806 added to function.ucfirst

From: Date: Thu, 05 Dec 2013 10:32:45 +0000
Subject: note 113806 added to function.ucfirst
Groups: php.notes 
Request: Send a blank email to php-notes+get-197752@lists.php.net to get a copy of this message
Implementation of multi-bytes ucfirst for "multiword"-strings (module mbstring is required): <?php public static function ucfirst($str) { $str = mb_strtolower($str); $words = preg_split('/\b/u', $str, -1, PREG_SPLIT_NO_EMPTY); foreach ($words as $word) { $ucword = mb_strtoupper(mb_substr($word, 0, 1)) . mb_substr($word, 1); $str = str_replace($word, $ucword, $str); } return $str; } ?> ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/function.ucfirst.php Edit -- https://master.php.net/note/edit/113806 Del: integrated -- https://master.php.net/note/delete/113806/integrated Del: useless -- https://master.php.net/note/delete/113806/useless Del: bad code -- https://master.php.net/note/delete/113806/bad+code Del: spam -- https://master.php.net/note/delete/113806/spam Del: non-english -- https://master.php.net/note/delete/113806/non-english Del: in docs -- https://master.php.net/note/delete/113806/in+docs Del: other reasons-- https://master.php.net/note/delete/113806 Reject -- https://master.php.net/note/reject/113806 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197752) next »