Created
December 22, 2010 13:45
-
-
Save troelskn/751517 to your computer and use it in GitHub Desktop.
Revisions
-
troelskn renamed this gist
Dec 22, 2010 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
troelskn created this gist
Dec 22, 2010 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ <?php /** * Transforms an under_scored_string to a camelCasedOne */ function camelize($scored) { return lcfirst( implode( '', array_map( 'ucfirst', array_map( 'strtolower', explode( '_', $scored))))); } /** * Transforms a camelCasedString to an under_scored_one */ function underscore($cameled) { return implode( '_', array_map( 'strtolower', preg_split('/([A-Z]{1}[^A-Z]*)/', $cameled, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY))); }