• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 670
  • Last Modified:

PHP- capitalize all words in a string

Hello!  I've been sitting here Googling this, but getting frustrated because I can't find the PHP code for what I want to do specifically:

$string = I want to CAPITALIZE all WOrds IN a sTRING

How can I make the above string read:

$string = I Want To Capitalize All Words In A Strong

Thank you in advance!!!
0
mcgeorge40
Asked:
mcgeorge40
  • 2
1 Solution
 
glcumminsCommented:
$string = "I want to CAPITALIZE all WOrds IN a sTRING";

$result = ucwords(strtolower($string));
0
 
mcgeorge40Author Commented:
Thanks.  I actually had that code...  And I realized I had a typo.  Darn!  Thank you for the quick response.
0
 
glcumminsCommented:
With PHP's schizophrenic function-naming conventions, typos are often easy to come by, and difficult to spot. I'm glad it is working for you now!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now