public function getTextLength($text) {
        $colorsList = array('0;30', '1;30', '0;34', '1;34', '0;32', '1;32', '0;36', '1;36', '0;31', '1;31', '0;35', '1;35', '0;33', '1;33', '0;37', '1;37', '40', '41', '42', '43', '44', '45', '46', '47', '0');
        foreach ($colorsList as $color) {
            $text = str_replace("\033[" . $color . "m", '', $text);
        }
        return strlen($text);
    }
public function getTextLength($text) {
        $colorsList = array('0;30', '1;30', '0;34', '1;34', '0;32', '1;32', '0;36', '1;36', '0;31', '1;31', '0;35', '1;35', '0;33', '1;33', '0;37', '1;37', '40', '41', '42', '43', '44', '45', '46', '47', '0');
        foreach ($colorsList as $color) {
            $text = str_replace("\033[" . $color . "m", '', $text);
        }
        return strlen($text);
    }
public function getTextLength ( $ text ) { $ colorsList = array ( '0;30' , '1;30' , '0;34' , '1;34' , '0;32' , '1;32' , '0;36' , '1;36' , '0;31' , '1;31' , '0;35' , '1;35' , '0;33' , '1;33' , '0;37' , '1;37' , '40' , '41' , '42' , '43' , '44' , '45' , '46' , '47' , '0' ) ; foreach ( $ colorsList as $ color ) { $ text = str_replace ( "\033[" . $ color . "m" , '' , $ text ) ; } return strlen ( $ text ) ; }
Return text length after removing colors
@param string $text
@return int
Return text length after removing colors