private function prepareForCasing($string): array
    {
        $string = str_replace(['.', '_', '-'], ' ', $string);

        // split on capital letters
        $string = implode(' ', preg_split('/(?<=\\w)(?=[A-Z])/', $string));

        // explode on numbers
        $parts = preg_split('/(,?\s+)|((?<=[a-z])(?=\d))|((?<=\d)(?=[a-z]))/i', $string);

        // return only words
        return array_values(array_filter($parts, function ($value) {
            return !empty($value);
        }));
    }
private function prepareForCasing($string): array
    {
        $string = str_replace(['.', '_', '-'], ' ', $string);

        // split on capital letters
        $string = implode(' ', preg_split('/(?<=\\w)(?=[A-Z])/', $string));

        // explode on numbers
        $parts = preg_split('/(,?\s+)|((?<=[a-z])(?=\d))|((?<=\d)(?=[a-z]))/i', $string);

        // return only words
        return array_values(array_filter($parts, function ($value) {
            return !empty($value);
        }));
    }
private function prepareForCasing ( $ string ) : array { $ string = str_replace ( [ '.' , '_' , '-' ] , ' ' , $ string ) ; // split on capital letters $ string = implode ( ' ' , preg_split ( '/(?<=\\w)(?=[A-Z])/' , $ string ) ) ; // explode on numbers $ parts = preg_split ( '/(,?\s+)|((?<=[a-z])(?=\d))|((?<=\d)(?=[a-z]))/i' , $ string ) ; // return only words return array_values ( array_filter ( $ parts , function ( $ value ) { return ! empty ( $ value ) ; } ) ) ; }
Clean up and chunk a string ready for use in casing the string value

@param string $string

@return array
Clean up and chunk a string ready for use in casing the string value