PHP ucwords() Function


The ucwords() 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
ucwords(string, delimiters)
Parameters
  • string - (Required) specify the string to convert.
  • delimiters - (Required) specify the word sperator to character.
Example
<?php
    echo ucwords("good morning");
?> 

Output

Good Morning!

Prev Next