Computer >> Computer tutorials >  >> Programming >> PHP

ucfirst() function in PHP


The ucfirst() function is used to convert the first character of a string to uppercase.

Syntax

ucfirst(str)

Parameters

  • str − The specified string

Return

The ucfirst() function returns the converted string.

Example

The following is an example −

<?php
   echo ucfirst("demo");
?>

Output

Demo