I have a variable like
$fullname = "dwayne-johnson";
How can I make the "d" of the first letter of the word dwayne and the "j" of the word johnson? like I want to make uppercase the first letter of the every word that is separated by dash, for example I have following variable (refer below)
$fullname1 = "dwayne-johnson" //expected result is, Dwayne Johnson
$fullname2 = "maria-osana-makarte" //expected result is, Maria Osana Makarte
as you can see from above the variable fullname1 have 2 words separated by dash and so the first letter in both words are capitalized. The second variable $fullname2 has 3 words separated by dash and so the first letter of each words within that variable is been capitalized. So how to make it capitalize the first letter of each words that is separated by dash in variable? Any clues, ideas, suggestions, help and recommendations is greatly appreciated. Thank you.
PS: i have already a function that convert the dash to space so now all I have to do is to make the first letter of every words that is separated by dash within the variable and the after it has been capitalized I will then inject the dash-space function on it.