Skip to content

Instantly share code, notes, and snippets.

@ExtevaXT
Created February 15, 2023 13:53
Show Gist options
  • Select an option

  • Save ExtevaXT/c3da7666eee25e89b38657c4117f2096 to your computer and use it in GitHub Desktop.

Select an option

Save ExtevaXT/c3da7666eee25e89b38657c4117f2096 to your computer and use it in GitHub Desktop.
function ToCamelCase($string){
// Max durability -> maxDurability
$words = explode(' ',strtolower($string));
$humps = array_slice($words, 1);
$humps = array_map('ucfirst', $humps);
array_unshift($humps , $words[0]);
return implode($humps);
}
echo ToCamelCase('Max durability');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment