Last active
April 11, 2019 18:46
-
-
Save benjaminpick/d37350e6f31767d0298469c330f26305 to your computer and use it in GitHub Desktop.
CamelCase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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