tags:

views:

28

answers:

1

I've finally found a rogue .php file that runs on a daily basis that essentially acts as a spell check for our product database. Most of it is no longer needed for various reasons (was created 10 years ago) so I'm trimming it. However, I don't know much PHP (I'm mostly HTML) and this one line is bugging me:

$name = ucwords(strtolower($name));

If I'm reading this correctly, this takes product names that are in all caps and changes them to lower case. Am I on the right track?

Thanks in advance.

+3  A: 

The ucwords function changes the first letter of all the words to uppercases. So yes, it takes a string, makes it all lower case, and then makes the first letter of each word uppercase.

 $string = "miXed Case woRds";
 $string = strtolower($string); // "mixed case words"
 $string = ucwords($string); // "Mixed Case Words"
Chacha102
Awesome, thanks a lot
Jensik
Just in case that wasn't clear, it'll change `$name` from something like `"MAGIC purple wIDGETS"` to `"Magic Purple Widgets"`
TokenMacGuy