A simple function that just helps if you're processing some user generated input and the user seems to have problems using uppercase letters... like for their name, etc....
#
# Quick function to first switch all words to lowercase,
# then capitalise the first letter of each word.
#
function flattenAndFatten($word){
$word = strtolower($word); // Lowercase
$word = ucfirst($word); // Capitalised
return $word;
}
It is used like this:
$name = 'jon Moore'; $betterName = flattenAndFatten($name); echo $betterName;
This will output Jon Moore
Main Category