note 68707 deleted from function.ucwords by cmb

From: Date: Sun, 04 Aug 2019 08:43:46 +0000
Subject: note 68707 deleted from function.ucwords by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-211785@lists.php.net to get a copy of this message
Note Submitter: philip at fcknet dot dk ---- Before noticing this function I made the following function (that does the same as ucwords): <?php function firstUpper($string) { $string = str_replace(array("Æ","Ø","Å"), array("æ","ø","å"), strtolower($string)); $ord = explode(" ", $string); $return = ""; foreach ($ord as $val) { $return .= " " . str_replace(array("æ","ø","å"), array("Æ","Ø","Å"), strtoupper($val{0})) . substr($val,1,strlen($val)-1); } return $return; } ?> It also converts Danish letters without using the setlocale function.

« previous php.notes (#211785) next »