public function filter($string, $replacement = '')
    {
        if ($replacement !== '') {
            return preg_replace_callback(static::REGEX_ANSI, function ($matches) use ($replacement) {
                return str_repeat($replacement, mb_strlen($matches[0]));
            }, $string);
        }
        return preg_replace(static::REGEX_ANSI, $replacement, $string);
    }
public function filter($string, $replacement = '')
    {
        if ($replacement !== '') {
            return preg_replace_callback(static::REGEX_ANSI, function ($matches) use ($replacement) {
                return str_repeat($replacement, mb_strlen($matches[0]));
            }, $string);
        }
        return preg_replace(static::REGEX_ANSI, $replacement, $string);
    }
public function filter ( $ string , $ replacement = '' ) { if ( $ replacement !== '' ) { return preg_replace_callback ( static :: REGEX_ANSI , function ( $ matches ) use ( $ replacement ) { return str_repeat ( $ replacement , mb_strlen ( $ matches [ 0 ] ) ) ; } , $ string ) ; } return preg_replace ( static :: REGEX_ANSI , $ replacement , $ string ) ; }
Filter takes a string with Cursor movements and filters them out

@param string $string
@param string $replacement Optional character or string to replace specific codes with

@return string
Filter takes a string with Cursor movements and filters them out