Strtoupper() is part of a small family of functions that affect the case of characters of strings. Strtoupper() takes one string parameter, and returns that string entirely in uppercase. Other variations include strtolower(), to convert the string to lowercase, ucfirst() to convert the first letter of every string to uppercase, and ucwords(), to convert the first letter of every word in the string to uppercase. They all take one parameter and return the converted result, so once you learn one you have learnt them all:
$string="i like to program in PHP"; $a=strtoupper($string); $b=strtolower($string); $c=ucfirst($string); $d=ucwords($string); $e=ucwords(strtolower($string)); ?>
Each of those variables get set to a slightly different value: $a becomes "I LIKE TO PROGAM IN PHP", $b becomes "i like to program in php", $c becomes "I like to program in PHP", $d becomes "I Like To Program In PHP", and $e becomes "I Like To Program In Php".
From that, you should be able to see that in calls such as ucwords(), PHP will not change existing capital letters to lowercase, which is why $d and $e are different - for $e, all the letters are lowercased first, then passed through ucwords() to make PHP into Php.
Copyright 2012 Future Publishing Limited (company
registered number 2008885), a company registered
in England and Wales whose registered office is at