Skip to content

Instantly share code, notes, and snippets.

@SofHad
Created August 16, 2013 11:37
Show Gist options
  • Save SofHad/6249152 to your computer and use it in GitHub Desktop.
Save SofHad/6249152 to your computer and use it in GitHub Desktop.
Function to Camelizes a string in PHP
/**
* 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