public static function underscore($string) {
        return static::cache(array(__METHOD__, $string), function() use ($string) {
            return trim(mb_strtolower(str_replace('__', '_', preg_replace('/([A-Z]{1})/', '_$1', preg_replace('/[^_a-z0-9]+/i', '', preg_replace('/[\s]+/', '_', $string))))), '_');
        });
    }
public static function underscore($string) {
        return static::cache(array(__METHOD__, $string), function() use ($string) {
            return trim(mb_strtolower(str_replace('__', '_', preg_replace('/([A-Z]{1})/', '_$1', preg_replace('/[^_a-z0-9]+/i', '', preg_replace('/[\s]+/', '_', $string))))), '_');
        });
    }
public static function underscore ( $ string ) { return static :: cache ( array ( __METHOD__ , $ string ) , function ( ) use ( $ string ) { return trim ( mb_strtolower ( str_replace ( '__' , '_' , preg_replace ( '/([A-Z]{1})/' , '_$1' , preg_replace ( '/[^_a-z0-9]+/i' , '' , preg_replace ( '/[\s]+/' , '_' , $ string ) ) ) ) ) , '_' ) ; } ) ; }
Inflect a word to an underscore form that strips all punctuation and special characters and converts spaces to underscores.

@param string $string
@return string
Inflect a word to an underscore form that strips all punctuation and special characters and converts spaces to underscores .