@param int  $num
@param int  $gender
@param bool $last

@return string
546075
private function showDigitsGroup($num, $gender = 0, $last = false)
    {
        /* A storage array for the return string.
             Positions 1, 3, 5 are intended for digit words
             and everything else (0, 2, 4) for "and" words.
             Both of the above types are optional, so the size of
             the array may vary.
        */
        $ret = [];

        // extract the value of each digit from the three-digit number
        $e = $num % 10;                  // ones
        $d = ($num - $e) % 100 / 10;         // tens
        $s = ($num - $d * 10 - $e) % 1000 / 100; // hundreds

        // process the "hundreds" digit.
        if ($s) {
            switch ($s) {
                case 1:
                    $ret[1] = self::$miscStrings['sto'];
                    break;
                case 2:
                case 3:
                    $ret[1] = self::$digits[0][$s] . self::$miscStrings['sta'];
                    break;
                default:
                    $ret[1] = self::$digits[0][$s] . self::$miscStrings['stotin'];
            }
        }

        // process the "tens" digit, and optionally the "ones" digit.
        if ($d) {
            // in the case of 1, the "ones" digit also must be processed
            if ($d == 1) {
                if (!$e) {
                    $ret[3] = self::$miscStrings['deset']; // ten
                } else {
                    if ($e == 1) {
                        $ret[3] = self::$miscStrings['edinadeset']; // eleven
                    } else {
                        $ret[3] = self::$digits[1][$e] . self::$miscStrings['na'] . self::$miscStrings['deset']; // twelve - nineteen
                    }
                    // the "ones" digit is alredy processed, so skip a second processment
                    $e = 0;
                }
            } else {
                $ret[3] = self::$digits[1][$d] . self::$miscStrings['deset']; // twenty - ninety
            }
        }

        // process the "ones" digit
        if ($e) {
            $ret[5] = self::$digits[$gender][$e];
        }

        // put "and" where needed
        if (count($ret) > 1) {
            if ($e) {
                $ret[4] = $this->and;
            } else {
                $ret[2] = $this->and;
            }
        }

        // put "and" optionally in the case this is the last non-empty group
        if ($last) {
            if (!$s || count($ret) == 1) {
                $ret[0] = $this->and;
            }
            $this->lastAnd = true;
        }

        // sort the return array so that "and" constructs go to theirs appropriate places
        ksort($ret);

        return implode($this->wordSeparator, $ret);
    }
274530
public function shorten($num) {
		$str = '';

		while ($num > 0) {
			$str = $this->alphabet[($num % $this->base)] . $str;
			$num = (int) ($num / $this->base);
		}

		return $str;
	}
366478
public static function intTo36Hex($num)
    {
        $num = intval($num);
        if ($num <= 0)
            return 0;
        $charArr = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
        $char = '';
        do {
            $key = ($num - 1) % 36;
            $char = $charArr[$key] . $char;
            $num = floor(($num - $key) / 36);
        } while ($num > 0);
        return $char;
    }
779426
public function clean($num)
    {
        $num = (float) $num;

        if ($this->min !== null && $num < $this->min) {
            $num = (float) $this->min;
        }

        if ($this->max !== null && $num > $this->max) {
            $num = (float) $this->max;
        }

        if ($this->forceInt) {
            $num = (int) $num;
        }

        return $num;
    }
379624
public function setGender($gender)
    {
        if (!is_string($gender) && !is_null($gender)) {
            throw new \InvalidArgumentException(__CLASS__ . ' ' . __METHOD__ . ': Not a string');
        }

        $this->gender = $gender;

        return $this;
    }
818000
static public function gender($value=null)
    {
        if (!$value) return 0;
        
        if (is_numeric($value)) {
            return $value == 1 ? 1 : ($value == 2 ? 2 : 0);
        } else {
            return $value == '男' ? 1 : ($value == '女' ? 2 : 0);
        }
    }
422612
private static function tilNextMillis($lastTimestamp)
    {
        $timestamp = self::timeGen();
        while ($timestamp <= $lastTimestamp) {
            $timestamp = self::timeGen();
        }
        return $timestamp;
    }
466655
public static function right(string $str, int $num) : string
    {
        return substr($str, Text::length($str)-$num, $num);
    }
363592
public function appendNum($bits, $num)
    {
        if ($bits == 0)
            return 0;

        $b = QRbitstream::newFromNum($bits, $num);

        if(is_null($b))
            return -1;

        $ret = $this->append($b);
        unset($b);

        return $ret;
    }
246478
public function getGender() : ?string 
    {
        if ( ! $this->hasGender()) {
            $this->setGender($this->getDefaultGender());
        }
        return $this->gender;
    }
750897
public static function toRoman($num)
  {
    $num = (int)$num;
    switch($num){
      case 1:
        $roman = 'I';
        break;
      case 2:
        $roman = 'II';
        break;
      case 3:
        $roman = 'III';
        break;
      case 4:
        $roman = 'IV';
        break;
      case 5:
        $roman = 'V';
        break;
      case 6:
        $roman = 'VI';
        break;
      case 7:
        $roman = 'VII';
        break;
      case 8:
        $roman = 'VIII';
        break;
      case 9:
        $roman = 'IX';
        break;
      case 10:
        $roman = 'X';
        break;
      default:
        $roman = (string)$num;
        break;
    }
    
    return $roman;
  }
1199084
function toMusicXML($num=1) {
        $out = '<part id="P'.$num.'">';

        if (!empty($this->measures)) {
            foreach ($this->measures as $key => $measure) {
                $out .= $measure->toMusicXML($key);
            }
        }

        $out .= '</part>';

        return $out;
    }
372231
static public function gender($value=null)
    {
        if (!$value) return '保密';
        
        if (is_numeric($value)) {
            return $value == 1 ? '男' : ($value == 2 ? '女' : '保密');
        } else {
            return $value == '男' ? '男' : ($value == '女' ? '女' : '保密');
        }
    }
32669
public function genderize(array $query)
    {
        $queryString = '?'.http_build_query($query);
        $url = 'http://api.genderize.io/'.$queryString;
        $response = $this->get($url);
        $this->setLastResponse($response);

        return $this->lastResponse->json();
    }
1021993
static public function getGenderValue($value=null)
    {
        return $value ? ($value == 1 || $value == '男' ? 1 : ($value == 2 || $value == '女' ? 2 : 0)) : 0;
    }
227356
function Last() {
        $items = $this->ToArray();
        $cnt = count($items);
        return $cnt > 0 ? $items[$cnt -1] : null;
    }
10060
public static function code2utf8($num) {
        if ($num < 128) {
            return chr($num);
        }
        if ($num < 2048) {
            return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
        }
        if ($num < 65536) {
            return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
        }
        if ($num < 2097152) {
            return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
        }
        return '';
    }