note 105991 added to function.ucwords
| From: | Philippe at osu1 dot php dot net | Date: | Fri, 30 Sep 2011 12:54:53 +0000 |
| Subject: | note 105991 added to function.ucwords | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183542@lists.php.net to get a copy of this message | ||
Because I needed a function that did the same as the function proper in Excel I created this little
function :
function proper($string){
$string = strtolower($string);
$lettersAndNumbers = 'abcdefghijklmnopqrstuvwxyz01234565789';
$string[0] = strtoupper($string[0]);
for ($index = 1;$index < strlen($string);$index++){
if (strpos($lettersAndNumbers, $string[$index]) === false){
if ($index +1 < strlen($string)){
$string[$index+1] = strtoupper($string[$index+1]);
$index++;
}
}
}
return($string);
}
----
Server IP: 69.147.83.197
Probable Submitter: 194.78.138.124
----
Manual Page -- http://www.php.net/manual/en/function.ucwords.php
Edit -- https://master.php.net/note/edit/105991
Del: integrated -- https://master.php.net/note/delete/105991/integrated
Del: useless -- https://master.php.net/note/delete/105991/useless
Del: bad code -- https://master.php.net/note/delete/105991/bad+code
Del: spam -- https://master.php.net/note/delete/105991/spam
Del: non-english -- https://master.php.net/note/delete/105991/non-english
Del: in docs -- https://master.php.net/note/delete/105991/in+docs
Del: other reasons-- https://master.php.net/note/delete/105991
Reject -- https://master.php.net/note/reject/105991
Search -- https://master.php.net/manage/user-notes.php