@param      $num
@param      $v1      //统计主标题
@param      $v2      //统计此标题
@param      $v3      //统计项
@param null $v4      //采样信息
@param int  $v5      //采样率，默认10%，如果需要千分之一则0.1
@param bool $replace //是否覆盖num

@return bool
350557
public function set($num, $v1, $v2, $v3, $v4 = null, $v5 = 10, $replace = false)
    {
        if (!$this->is_stat) {
            return false;
        }

        $num = (int)$num;
        $v1  = trim($v1);
        $v2  = trim($v2);
        $v3  = trim($v3);
        $v4  = trim($v4);
        if ($num <= 0 || !isset($v1[0]) || !isset($v2[0]) || !isset($v3[0])) {
            return false;
        }

        //采样
        if ($v4 !== null) {
            $prob = ceil(100 / $v5);
            $rt   = mt_rand(1, $prob);
            $v4   = $rt == 1 ? substr($v4, 0, 500) : null;
        }

        $data = array(
            //按照DB划分
            'dbf'     => $this->db_prefix,
            //累计值
            'num'     => (int)$num,
            //大分类
            'v1'      => $v1,
            //小分类
            'v2'      => $v2,
            //具体统计对象
            'v3'      => $v3,
            //采样信息
            'v4'      => $v4,
            'replace' => $replace,
            //记录时间
            'time'    => time(),
        );
        array_push($this->data, $data);

        if (count($this->data) >= 100) {
            $this->log();
            $this->data = array();
        }
    }
705866
public static function at($string, $num)
    {
        $num = (int) $num;

        if (Utf8String::strlen($string) < $num) {
            return null;
        }

        return Utf8String::substr($string, $num, 1);
    }
11376
public static function rgb($v1,$v2=null,$v3=null)
	{
		if(is_null($v2)){
			$rgb = $v1;
			$r = ($rgb >> 16) & 0xFF;
			$g = ($rgb >> 8) & 0xFF;
			$b = $rgb & 0xFF;
			$self = new self();
			return $self->r($r)->g($g)->b($b);
		}else{
			$r = $v1 & 0xFF;
			$g = $v2 & 0xFF;
			$b = $v3 & 0xFF;
			$self = new self();
			return $self->r($r)->g($g)->b($b);
		}
	}
978209
public static function encodeNum($num)
        {
            $addTab = array(0=>'', 1=>'z', 2=>'Z', 3=>'+');
            $map = '0123456789abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXY';
            $mapPos = $num % 60;
            $mapAdd = (int)($num / 60);
            
            return $addTab[$mapAdd].$map[$mapPos];
        }
229355
function _convertNumber($num)
    {
        // Integer in the range 0..2**16-1
        if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
            return pack("Cv", $this->ptg['ptgInt'], $num);
        } else { // A float
            if ($this->_byte_order) { // if it's Big Endian
                $num = strrev($num);
            }
            return pack("Cd", $this->ptg['ptgNum'], $num);
        }
    }
195734
public static boolean isNumber(final String num) {
    if (num == null || num.length() == 0) {
      return false;
    }
    final boolean firstIsDigit = Character.isDigit(num.charAt(0));
    if (!firstIsDigit && num.charAt(0) != '-') {
      return false;
    }
    boolean dig = firstIsDigit;
    for (int i = 1; i < num.length(); i++) {
      if (!Character.isDigit(num.charAt(i))) {
        return false;
      }
      dig = true;
    }
    return dig;
  }
270678
public function seek($num)
    {
        if ($num >= 0 && $num <= $this->count() - 1) {
            if (!$this->resource->data_seek($num)) {
                return false;
            }

            $this->cursor_position = $num;

            return true;
        }

        return false;
    }
108221
public function randomEx($num = 1)
	{
		if($this->isSelectBefore)
		{
			$this->__selectBefore();
		}
		$opt = $this->getOption();
		$field = isset($opt['field']) ? $opt['field'] : '*';
		$opt['field'] = array('count(*)');
		// 取记录数量
		$this->db->operationOption = $opt;
		$sum = $this->db->getScalar();
		$opt['field'] = $field;
		// 随机出记录位置
		$limits = randomNums(0, $sum - 1, $num);
		$results = array ();
		// 循环取出多条记录
		foreach ($limits as $value)
		{
			$opt['limit'] = array($value,1);
			$this->db->operationOption = $opt;
			$results[] = $this->db->getOne();
		}
		$this->__selectAfter($results,$opt);
		return $results;
	}
880310
public static function mul($num1, $num2)
    {
        if (!static::is($num1) || !static::is($num2)) {
            throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
        }

        return ($num1 * $num2);
    }
1352893
private function encodeSignedNumber($num)
    {
        $sgn_num = $num << 1;
        if ($num < 0) {
            $sgn_num = ~($sgn_num);
        }
        return $this->encodeNumber($sgn_num);
    }
1268940
static function romanNumeral( $num ) {
		static $table = array(
			array( '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X' ),
			array( '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', 'C' ),
			array( '', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', 'M' ),
			array( '', 'M', 'MM', 'MMM' )
		);

		$num = intval( $num );
		if ( $num > 3000 || $num <= 0 ) {
			return $num;
		}

		$s = '';
		for ( $pow10 = 1000, $i = 3; $i >= 0; $pow10 /= 10, $i-- ) {
			if ( $num >= $pow10 ) {
				$s .= $table[$i][floor( $num / $pow10 )];
			}
			$num = $num % $pow10;
		}
		return $s;
	}
238250
public function isValidRealNumber($v) : bool
    {
        return (  (is_int($v) === true || is_float($v) === true) || 
                  (is_string($v) === true && is_numeric($v) === true) || 
                  ($v instanceof RealNumber) );
    }
1129396
private static function num2str(int $num):string
    {
        if ($num > 0 && $num < 160) {
            return chr($num);
        } elseif ($num < -20319 || $num > -10247) {
            return '';
        } else {
            $total = sizeof(self::$lib) - 1;
            for ($i = $total; $i >= 0; $i--) {
                if (self::$lib[$i][1] <= $num) {
                    break;
                }
            }
            return self::$lib[$i][0];
        }
    }
1230359
function vv(i, v, inc) {
		var vn = !isNaN(v);
		var nv = vn ? v : v || self.versionMatch[i] || '';
		if (inc && vn) {
			return +nv + 1;
		} else if (inc) {
			// increment the last numeric value sequence
			return nv.replace(regexVerLast, function vvInc(m) {
				return +m + 1;
			});
		}
		return nv;
	}
289239
private function hue2rgb($v1, $v2, $hue)
		{
		if ($hue < 0)
			{
			$hue += 1;
			}
		if ($hue > 1)
			{
			$hue -= 1;
			}
		if ((6 * $hue) < 1)
			{
			return ($v1 + ($v2 - $v1) * 6 * $hue);
			}
		if ((2 * $hue) < 1)
			{
			return ($v2);
			}
		if ((3 * $hue) < 2)
			{
			return ($v1 + ($v2 - $v1) * (( 2 / 3) - $hue) * 6);
			}
		return $v1;
		}
400574
public static function num2rmb($number = 0, $int_unit = '元', $is_round = true, $is_extra_zero = false)
    {
        // 将数字切分成两段
        $parts = explode('.', $number, 2);
        $int = isset($parts[0]) ? strval($parts[0]) : '0';
        $dec = isset($parts[1]) ? strval($parts[1]) : '';

        // 如果小数点后多于2位，不四舍五入就直接截，否则就处理
        $dec_len = strlen($dec);
        if (isset($parts[1]) && $dec_len > 2) {
            $dec = $is_round
                ? substr(strrchr(strval(round(floatval("0.".$dec), 2)), '.'), 1)
                : substr($parts[1], 0, 2);
        }

        // 当number为0.001时，小数点后的金额为0元
        if (empty($int) && empty($dec)) {
            return '零';
        }

        // 定义
        $chs = array('0','壹','贰','叁','肆','伍','陆','柒','捌','玖');
        $uni = array('','拾','佰','仟');
        $dec_uni = array('角', '分');
        $exp = array('', '万');
        $res = '';

        // 整数部分从右向左找
        for ($i = strlen($int) - 1, $k = 0; $i >= 0; $k++) {
            $str = '';
            // 按照中文读写习惯，每4个字为一段进行转化，i一直在减
            for ($j = 0; $j < 4 && $i >= 0; $j++, $i--) {
                $u = $int{$i} > 0 ? $uni[$j] : ''; // 非0的数字后面添加单位
                $str = $chs[$int{$i}] . $u . $str;
            }
            //echo $str."|".($k - 2)."<br>";
            $str = rtrim($str, '0');// 去掉末尾的0
            $str = preg_replace("/0+/", "零", $str); // 替换多个连续的0
            if (!isset($exp[$k])) {
                $exp[$k] = $exp[$k - 2] . '亿'; // 构建单位
            }
            $u2 = $str != '' ? $exp[$k] : '';
            $res = $str . $u2 . $res;
        }

        // 如果小数部分处理完之后是00，需要处理下
        $dec = rtrim($dec, '0');

        // 小数部分从左向右找
        if (!empty($dec)) {
            $res .= $int_unit;

            // 是否要在整数部分以0结尾的数字后附加0，有的系统有这要求
            if ($is_extra_zero) {
                if (substr($int, -1) === '0') {
                    $res.= '零';
                }
            }

            for ($i = 0, $cnt = strlen($dec); $i < $cnt; $i++) {
                $u = $dec{$i} > 0 ? $dec_uni[$i] : ''; // 非0的数字后面添加单位
                $res .= $chs[$dec{$i}] . $u;
            }
            $res = rtrim($res, '0');// 去掉末尾的0
            $res = preg_replace("/0+/", "零", $res); // 替换多个连续的0
        } else {
            $res .= $int_unit . '整';
        }
        return $res;
    }
802940
public static function add($num1, $num2)
    {
        if (!static::is($num1) || !static::is($num2)) {
            throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
        }

        return ($num1 + $num2);
    }