public static function variable($string) {
        $string = preg_replace('/[^_a-z0-9]+/i', '', $string);

        if (is_numeric(mb_substr($string, 0, 1))) {
            $string = '_' . $string;
        }

        return $string;
    }
public static function variable($string) {
        $string = preg_replace('/[^_a-z0-9]+/i', '', $string);

        if (is_numeric(mb_substr($string, 0, 1))) {
            $string = '_' . $string;
        }

        return $string;
    }
public static function variable ( $ string ) { $ string = preg_replace ( '/[^_a-z0-9]+/i' , '' , $ string ) ; if ( is_numeric ( mb_substr ( $ string , 0 , 1 ) ) ) { $ string = '_' . $ string ; } return $ string ; }
Inflect a word to be used as a PHP variable. Strip all but letters, numbers and underscores. Add an underscore if the first letter is numeric.

@param string $string
@return string
Inflect a word to be used as a PHP variable . Strip all but letters numbers and underscores . Add an underscore if the first letter is numeric .