PHP.nl

ucfirst

ucfirst

Make a string's first character uppercase

string **ucfirst** string $string

Returns a string with the first character of capitalized, if that character is an ASCII character in the range from (0x61) to (0x7a). string``"a"``"z"

stringThe input string.

Returns the resulting string.

Voorbeeld: example

<?php
$foo = 'hello world!';
echo ucfirst($foo), PHP_EOL;             // Hello world!

$bar = 'HELLO WORLD!';
echo ucfirst($bar), PHP_EOL;             // HELLO WORLD!
echo ucfirst(strtolower($bar)), PHP_EOL; // Hello world!
?>

lcfirst``strtolower``strtoupper``ucwords``mb_convert_case