Latest web development tutorials

PHP ucfirst () function

PHP String Reference PHP String Reference

Examples

The "hello" in the first character converted to uppercase:

<?php
echo ucfirst("hello world!");
?>

Running instance »

Definition and Usage

ucfirst () function to convert the first character in the string to uppercase.

Related functions:


grammar

ucfirst( string )

参数 描述
string 必需。规定要转换的字符串。

technical details

return value: Returns the converted string.
PHP version: 4+


PHP String Reference PHP String Reference