I'm looking for the PHP script to strip all CAPS and then only Capitalize first letter of each word... ie. "THIS IS A TEST" becomes "This Is A Test" Can anyone help?
What would the modification be if some of the values are in the format "WESTON-SUPER-MARE" or "BARROW-IN-FURNESS" using "-" instead of space (and you want to retain those "-"s) but want to apply the capitalization rule?
Ok just found a function for this elsewhere, so posting it here incase anyone else needs it: <? function Capitalize($name) { $name = strtolower($name); $name = join("'", array_map('ucwords', explode("'", $name))); $name = join("-", array_map('ucwords', explode("-", $name))); $name = join("Mac", array_map('ucwords', explode("Mac", $name))); $name = join("Mc", array_map('ucwords', explode("Mc", $name))); return $name; } echo Capitalize('BURY-ON-THAMES') . '<br>'; echo Capitalize('ISLE OF WIGHT') . '<br>'; echo Capitalize('MCDONALD') . '<br>'; ?>