Is it possible to edit a string like Text-element
to TextElement
? After each - it needs an capital letter.
I can't get it done and can't figure out a way to do this.
Is it possible to edit a string like Text-element
to TextElement
? After each - it needs an capital letter.
I can't get it done and can't figure out a way to do this.
You could do:
$text = implode(array_map('ucfirst',explode('-',$str)));
First we split all string at point of hyphen -
and then each of the first letter would be in caps. Then, join it back.