Last active
December 18, 2015 15:39
-
-
Save caseysoftware/5806196 to your computer and use it in GitHub Desktop.
preg_replace after, removing /e
This file contains hidden or 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
| public static function decamelize($word) | |
| { | |
| $callback = create_function('$matches', | |
| 'return strtolower(strlen("$matches[1]") ? | |
| "$matches[1]_$matches[2]" : "$matches[2]");'); | |
| return preg_replace_callback( | |
| '/(^|[a-z])([A-Z])/', | |
| $callback, | |
| $word | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment