PHP ucwords() function

The ucwords() function converts the first character of each word in a string to uppercase.

Syntax

ucwords ( string $string,$delimiters='\t\r\n\f\v') : string

Parameters

Parameter Name Descrption
$string Required, The input string.
$delimiters

Optional, The ucwords() function return each word in a string to uppercase, is checked each word after any character listed in the delimiters patameters (By default these are space, newline, carriage return, form-feed, horizontal tab, and vertical tab).

Return Value

Returns the string.

ucwords() examples

echo ucwords('Test string'); 
//Test String

echo ucwords('PHP Test&string','&');  
//PHP Test&String

Related Functions