jvitstringcamel
JVIT PHPecho convertToCamelCase("studlyCase String"); result: StudlyCaseString
Shortcut: camel
/**
* Convert a value to studly caps case.
*
*
* @param string $value
* @return string StudlyCaseString
*/
function convertToStudlyCase($value)
{
$words = explode(' ', str_replace(['-', '_'], ' ', $value));
$studlyWords = array_map(function ($word) {
return ucfirst($word);
}, $words);
return implode($studlyWords);
}
/**
* Convert a value to camel case.
*
* @param string $value
* @return string
*/
function convertToCamelCase($value)
{
return lcfirst(convertToStudlyCase($value));
}