w3resource

PHP: ucwords() function

Description

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

Version:

(PHP 4 and above)

Syntax:

ucwords(string_name)

Parameter:

Name Description Required /
Optional
Type
string_name The input string. Required String

Return value:

The modified string.

Value Type: String.

Pictorial Presentation

string_ucwords

Example:

<?php
$string_name='welcome to w3resource.com';
$string_name=ucwords($string_name);
echo $string_name;
?>

Output :

Welcome To W3resource.com

View the example in the browser

See also

PHP Function Reference

Previous: ucfirst
Next: vfprintf



PHP: Tips of the Day

PHP: Where is PHP.ini in Mac OS X Lion? Thought it was in /usr/local/php5/lib

You should find it in /private/etc if it exists, otherwise:

sudo cp /private/etc/php.ini.default /private/etc/php.ini

Ref : https://bit.ly/3nYzEyI