Created
August 16, 2013 11:37
-
-
Save SofHad/6249152 to your computer and use it in GitHub Desktop.
Function to Camelizes a string in PHP
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
/** | |
* Camelizes a string. | |
* | |
* @param string $id A string to camelize | |
* | |
* @return string The camelized string | |
*/ | |
public static function camelize($id) | |
{ | |
return strtr(ucwords(strtr($id, array('_' => ' ', '.' => '_ '))), array(' ' => '')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment