src/Util/Str.php
public static function machine($str, $separator = '_')
    {
        $out = strtolower($str);
        $out = preg_replace('/[^a-z0-9' . $separator . ']/', $separator, $out);
        $out = preg_replace('/' . $separator . '{2,}/', $separator, $out);
        $out = preg_replace('/^' . $separator . '/', '', $out);
        $out = preg_replace('/' . $separator . '$/', '', $out);
        return $out;
    }
public static function machine($str, $separator = '_')
    {
        $out = strtolower($str);
        $out = preg_replace('/[^a-z0-9' . $separator . ']/', $separator, $out);
        $out = preg_replace('/' . $separator . '{2,}/', $separator, $out);
        $out = preg_replace('/^' . $separator . '/', '', $out);
        $out = preg_replace('/' . $separator . '$/', '', $out);
        return $out;
    }
public static function machine ( $ str , $ separator = '_' ) { $ out = strtolower ( $ str ) ; $ out = preg_replace ( '/[^a-z0-9' . $ separator . ']/' , $ separator , $ out ) ; $ out = preg_replace ( '/' . $ separator . '{2,}/' , $ separator , $ out ) ; $ out = preg_replace ( '/^' . $ separator . '/' , '' , $ out ) ; $ out = preg_replace ( '/' . $ separator . '$/' , '' , $ out ) ; return $ out ; }
Machinize the string
@param string $str
@param string $separator
@return string
Machinize the string