Skip to content

Instantly share code, notes, and snippets.

@SofHad
Created August 16, 2013 11:37
Show Gist options
  • Select an option

  • Save SofHad/6249152 to your computer and use it in GitHub Desktop.

Select an option

Save SofHad/6249152 to your computer and use it in GitHub Desktop.

Revisions

  1. SofHad created this gist Aug 16, 2013.
    11 changes: 11 additions & 0 deletions FunctionToCamelizesAString
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    /**
    * 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(' ' => ''));
    }