- ucwords: documentation ( source)
- str_replace: documentation ( source)
<?php
function dashesToCamelCase($string, $capitalizeFirstCharacter = false)
{
$str = str_replace(' ', '', ucwords(str_replace('-', ' ', $string)));
return $str;
}
echo dashesToCamelCase('this-is-a-string');