Friday, April 6, 2012

Make the first character of a string in uppercase.

Make the first character of a string in uppercase. 

Using PHP ucfirst() function we can uppercase the first character of a string. PHP has this inbuilt function to uppercase the first letter of any string. Look at the below code for better explaination:

PHP Code:
<?php
$STRING 
"hello, i love this website.";
$STRING ucfirst($STRING);
echo 
$STRING;?>
The output of the above code will be:
Code:
Hello, i love this website.

No comments:

Post a Comment