Last active
December 18, 2015 15:39
-
-
Save caseysoftware/5806193 to your computer and use it in GitHub Desktop.
preg_replace before, using /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) | |
| { | |
| return preg_replace( | |
| '/(^|[a-z])([A-Z])/e', | |
| 'strtolower(strlen("\\1") ? "\\1_\\2" : "\\2")', | |
| $word | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment