Skip to content

Uppercase the first character of each word in a string using PHP

You can use “ucwords()” to uppercase the first character of each word in a string.

e.g.

$myVar = 'this is a test!'; $myVar = ucwords($myVar); // This Is A Test!
Code language: PHP (php)

See also  Halving Sum in Python
Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x