Answers for "php convert words with spaces to camelcase"

PHP
2

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;
}
Posted by: Guest on September-03-2020
2

php function to convert string to camelcase

echo ucwords("hello world");
Posted by: Guest on May-15-2020

Code answers related to "php convert words with spaces to camelcase"

Browse Popular Code Answers by Language