PHP ucfirst() Function
In this chapter you will learn:
- Definition for PHP ucfirst() Function
- Syntax for PHP ucfirst() Function
- Parameter for PHP ucfirst() Function
- Return for PHP ucfirst() Function
- Example - Convert the first letter to uppercase
Definition
The ucfirst()
function takes string and converts
its first letter to an uppercase character.
Syntax
PHP ucfirst() Function has the following syntax.
string ucfirst ( string str )
Parameter
str
is the value we want to convert.
Return
PHP ucfirst() function returns the string with first letter converted.
Example
Convert the first letter to uppercase
<?PHP/*j a v a2 s. c o m*/
$string = "java2s.com";
$a = ucfirst($string);
print($a);
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP ucwords() Function
- Syntax for PHP ucwords() Function
- Parameter for PHP ucwords() Function
- Return for PHP ucwords() Function
- Example - Convert words in a string to uppercase
Home » PHP Tutorial » PHP String Functions