Convert a string to camel case.

@param string $string

@return string
325662
public function toCamelCase(string $string): string
    {
        $words = \str_replace(['-', '_'], ' ', $string);

        $words = \str_replace(' ', '', \ucwords($words));

        return \lcfirst($words);
    }
783251
public static function camelCase($string, $char = '_', $lcFirst = false)
    {
        $data = \preg_replace_callback(
            '~' . $char . '([a-zа-яё])~u',
            [static::class, '_upperCase'],
            $string
        );

        if ($lcFirst)
        {
            return static::lcFirst($data);
        }

        return $data;
    }
946177
public static function camelize( $string , $upper = true ) {

        if ( $upper )
            $string = preg_replace_callback( '/^[a-z0-9]+/' , function( $find ){ return self::capitalize( $find[0] ); } , $string );
        else
            $string = preg_replace_callback( '/^[a-z0-9]+/' , function( $find ){ return strtolower( $find[0] ); } , $string );

        $string = preg_replace_callback( '/(_|\\/)([a-z0-9]+)/' , function( $find ){

            return self::capitalize( $find[2] );

        } , $string );

        $string = str_replace( '/' , '::' , $string );

        return $string;

    }
286917
private function camelize($string, $lower = true)
    {
        $words = explode('_', strtolower($string));

        $camelized = '';

        foreach ($words as $word) {
            if (strpos($word, '_') === false) {
                $camelized .= ucfirst(trim($word));
            }
        }

        return ($lower) ? lcfirst($camelized) : $camelized;
    }
65702
def camel_case(string):
    
    if not string:
        return string
    parts = snake_case(string).split('_')
    rv = ''
    while parts:
        part = parts.pop(0)
        rv += part or '_'
        if part:
            break
    return rv + ''.join(x.title() for x in parts)
855517
protected function textCamelToUnderscore($string)
    {
        $camelized_string_tokens = preg_split('/(?<=[^A-Z])(?=[A-Z])/', $string);
        if (count($camelized_string_tokens) > 0) {
            return mb_strtolower(implode('_', $camelized_string_tokens));
        }

        return $string;
    }
488944
public function bumpyCase($string)
    {
        $words = explode('_', $string);
        foreach ($words as &$word) {
            $word = ucfirst($word);
        }
        unset ($word);
        
        $camelCase = implode('', $words);
        return $camelCase;
    }
687600
public static function camelCase(string $string, array $noStrip = null, bool $lowerCaseFirstLetter = null)
    {
        // non-alpha and non-numeric characters become spaces
        $string = preg_replace('/[^a-z0-9' . implode('', $noStrip ?? []) . ']+/i', ' ', $string);
        $string = trim($string);
        $string = ucwords($string);
        $string = str_replace(' ', '', $string);

        if ($lowerCaseFirstLetter === null || $lowerCaseFirstLetter === true) {
            $string = lcfirst($string);
        }

        return $string;
    }
561470
public function camelizeBundle($string)
    {
        $string = $this->camelize($string);
        $string = str_replace('_bundle', '', $string);

        return $string;
    }
1223662
public static function upperCase(?string $string = null): ?string
    {
        if ($string === null) {
            return null;
        }

        return mb_strtoupper($string, 'UTF-8');
    }
670090
public function replace($string)
    {
        foreach ($this->bag as $key => $value) {
            $string = str_replace($key, $value, $string);
        }

        return $string;
    }
773472
public static function safe(string $string) : string
  {
    $split = str_split($string);

    foreach($split as $k => $char) {
      if (str_contains('~!@#$%^&*()_-=+<>/\?;:{}[]|,.', $char)) {
        unset($split[$k]);
      }
    }

    return implode('', $split);
  }
1241713
private static function toCamelCase(string $text): string
    {
        if (strpos($text, '_') !== false) {
            $text = str_replace(' ', '', ucwords(str_replace('_', ' ', $text)));
        }
        $text[0] = strtolower($text[0]);

        return $text;
    }
394264
public static function camelCaseToSeparated($string, $separator = '-', $toLowerCase = true)
    {
        $separated = preg_replace(['/([a-z\d])([A-Z])/', '/([^' . preg_quote($separator) . '])([A-Z][a-z])/'], '$1' . $separator . '$2', $string);
        return $toLowerCase ? strtolower($separated) : $separated;
    }
534307
public function apply(string $string) : string
    {
        return preg_replace($this->pattern, $this->replacement, $string);
    }
947832
public static function strToUpper($string)
    {
        $string = str_replace(self::$lowerTR, self::$upperTR, $string);

        return mb_strtoupper($string, 'UTF-8');
    }
1126692
static function CamelCase($string) {
		$string = preg_replace_callback('#([_])(\w)#', function ($m) {
			return strtoupper($m[2]);
		}, strtolower($string));

		return ucfirst($string);
	}