convert snake case to ucfirst code example
Example 1: php function to convert string to camelcase
echo ucwords("hello world");
Example 2: php string underscore into camelcase
function dashesToCamelCase($string, $capitalizeFirstCharacter = false)
{
$str = str_replace(' ', '', ucwords(str_replace('-', ' ', $string)));
if (!$capitalizeFirstCharacter) {
$str[0] = strtolower($str[0]);
}
return $str;
}
echo dashesToCamelCase('this-is-a-string');