note 14705 added to function.substr.php
| From: | nospam at ihatespam dot com | Date: | Fri, 10 Aug 2001 17:50:50 +0000 |
| Subject: | note 14705 added to function.substr.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16552@lists.php.net to get a copy of this message | ||
FROM: danny cook
This is a function that turns a normal string into Title Case (I also put it into the strtoupper and
strtolower comments..)
<?
function strtotitle($str) {
$firstletter = substr($str,0,1);
$firstletter = strtoupper($firstletter);
return $firstletter.substr($str,1);
}
?>
ps: to the people who develop php: a function like this already embedded in the code would be very
useful, as well as maintaining consistency with strtoupper and strtolower functions...
http://www.php.net/manual/en/function.substr.php