PHP ucwords() Function

PHP ucwords() Function

The ucwords() function in PHP converts the first character of each word in the specified string to uppercase. It is a binary-safe function.

The related function are as follows:

  • ucfirst()
  • lcfirst()
  • strtoupper()
  • strtolower()

Syntax

Parameter

str(required)- This parameter represents the input string.

delimeters(optional)– This parameter contains the word separator characters i.e ‘\t, \r, \n, \f, \v’.

Return

This parameter returns a string with the first character of each word in the specified string capitalized if that character is alphabetic.

Example 1

Output

Example 2

Output

Example 3

Output

Example 4

Output