Skip to content

Instantly share code, notes, and snippets.

@benjaminpick
Last active April 11, 2019 18:46
Show Gist options
  • Save benjaminpick/d37350e6f31767d0298469c330f26305 to your computer and use it in GitHub Desktop.
Save benjaminpick/d37350e6f31767d0298469c330f26305 to your computer and use it in GitHub Desktop.
CamelCase
<?php
function underscoreToCamelCase($string)
{
$str = str_replace(' ', '', ucwords(str_replace('_', ' ', $string)));
$str = lcfirst($str);
return $str;
}
function camelCaseToUnderscore($string)
{
return mb_strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $class_name))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment