note 14841 added to function.strtoupper.php
| From: | will at digitalinflux dot com | Date: | Fri, 17 Aug 2001 05:13:03 +0000 |
| Subject: | note 14841 added to function.strtoupper.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16830@lists.php.net to get a copy of this message | ||
I needed a way to take a string of characters and convert the first element to uppercase. since
strtoupper operates on the whole string, I used a combination of substr, and substr_replace to pick
out the uppercase letter of the first string.
$result = substr_replace ($string, substr(strtoupper($string), 0, 1), 0, 1)
http://www.php.net/manual/hu/function.strtoupper.php