ucfirst

Make a string's first character uppercase

Syntax

ucfirst ( string $str ) : string

Parameters

str

The input string.

Return

Returns the resulting string.

Examples

1

<?

$str = 'Hello World!';

$return = ucfirst($str);

echo $return;

?>
Hello World!

2

<?

$str = 'hello world!';

$return = ucfirst($str);

echo $return;

?>
Hello world!

3

<?

$str = 'HELLO WORLD!';

$return = ucfirst($str);

echo $return;

?>
HELLO WORLD!

PHP

Home Menu