public static function clean(string $string, string $replace = "", string $regex = self::CLEAN)
    {
        if ($replace === null) :
            $replace = "";
        endif;
        if ($regex === null) :
            $regex = self::CLEAN;
        endif;
    
        return preg_replace($regex, $replace, $string);
    }
public static function clean(string $string, string $replace = "", string $regex = self::CLEAN)
    {
        if ($replace === null) :
            $replace = "";
        endif;
        if ($regex === null) :
            $regex = self::CLEAN;
        endif;
    
        return preg_replace($regex, $replace, $string);
    }
public static function clean ( string $ string , string $ replace = "" , string $ regex = self :: CLEAN ) { if ( $ replace === null ) : $ replace = "" ; endif ; if ( $ regex === null ) : $ regex = self :: CLEAN ; endif ; return preg_replace ( $ regex , $ replace , $ string ) ; }
Clean a string by removing any characters we don't want.

@param string $string        The string we're cleaning.
@param string $replace       What to replace "bad" characters with.
@param string $regex         (optional) The regex determing "good" characters.
@return string
Clean a string by removing any characters we don t want .