Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php convert words with spaces to camelcase

public static function camelCase($str, array $noStrip = [])
{
        // non-alpha and non-numeric characters become spaces
        $str = preg_replace('/[^a-z0-9' . implode("", $noStrip) . ']+/i', ' ', $str);
        $str = trim($str);
        // uppercase the first character of each word
        $str = ucwords($str);
        $str = str_replace(" ", "", $str);
        $str = lcfirst($str);

        return $str;
}
Source by www.mendoweb.be #
 
PREVIOUS NEXT
Tagged: #php #convert #words #spaces #camelcase
ADD COMMENT
Topic
Name
8+1 =