PHP ucfirst () function
Examples
The "hello" in the first character converted to uppercase:
<?php
echo ucfirst("hello world!");
?>
echo ucfirst("hello world!");
?>
Running instance »
Definition and Usage
ucfirst () function to convert the first character in the string to uppercase.
Related functions:
- lcfirst () - the first character of the string converted to lowercase
- ucwords () - the first character of each word in a string to uppercase
- the strtoupper () - convert a string to uppercase
- strtolower () - convert string to lowercase
grammar
ucfirst( string )
参数 | 描述 |
---|---|
string | 必需。规定要转换的字符串。 |
technical details
return value: | Returns the converted string. |
---|---|
PHP version: | 4+ |
PHP String Reference