PHP: ucfirst() function
PHP: Make a string's first character uppercase
The ucfirst() function is used to convert the first character of a string to uppercase.
Version:
(PHP 4 and above)
Syntax:
ucfirst(string_name)
Parameter:
Name | Description | Required / Optional |
Type |
---|---|---|---|
string_name | The input string. | Required | String |
Return value:
Returns the modified string.
Value Type: String.
Pictorial Presentation
Example:
<?php
$string_name='welcome to w3resource.com';
$string_name=ucfirst($string_name);
echo $string_name;
?>
Output :
Welcome to w3resource.com
View the example in the browser
See also
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/php/function-reference/ucfirst.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics