1function dashesToCamelCase($string, $capitalizeFirstCharacter = false)
2{
3
4 $str = str_replace(' ', '', ucwords(str_replace('-', ' ', $string)));
5
6 if (!$capitalizeFirstCharacter) {
7 $str[0] = strtolower($str[0]);
8 }
9
10 return $str;
11}
12
13echo dashesToCamelCase('this-is-a-string');