On Thu, 12 Sep 2002 05:21:01 +0300, you wrote: [...] >$name = "mattson-hedman" # correct format is Mattson-Hedman, but user >can write in many ways. $name came from db. > >so how I can convert this $name format "Mattson-Hedman". [...]
Try this: function uc_all ($str) { $temp = preg_split('/(\W)/', $str, -1,PREG_SPLIT_DELIM_CAPTURE); foreach ($temp as $key => $word) { $temp[$key] = ucfirst(strtolower($word)); } return join ('', $temp); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php