to convert first letters in a firstname like: "jean-pierre" to "Jean-Pierre":
I simply replace the '-' with a vertical tabulation, because the ucwords() function replace the letter just after it.
so, I use the sentence:
$result=str_replace(chr(11),'-',ucwords(strtolower(str_replace('-',chr(11),$firstname))));