I\'m looking for a way to uppercase the first letter/s of a string, including where the names are joined by a hyphen, such as adam smith-jones needs to be Adam Smith-Jones.
Is this ok ?
function to_upper($name) { $name=ucwords($name); $arr=explode('-', $name); $name=array(); foreach($arr as $v) { $name[]=ucfirst($v); } $name=implode('-', $name); return $name; } echo to_upper("adam smith-jones");