PHP ucfirst() Function


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

  • lcfirst - (Required) convert the first character only a string to lowercase.
  • ucwords - (Required) convert the first character each word a string to uppercase.
  • strtolower - (Required) convert the string to lowercase.
  • strtoupper - (Required) convert the string to uppercase.

Syntax
ucfirst(string)
Parameters
  • string - (Required) specify the string to convert.
Example
<?php
    echo ucfirst("good Morning!");
?> 

Output

Good Morning!

Prev Next