convert decimal to roman numerals
@param  int    $num decimal
@return string      roman numerals
340812
public static function toRoman(int $num) : string
    {
        $result = '';
        foreach (self::$romans as $roman => $value) {
            $matches = intval($num / $value);
            $result .= str_repeat($roman, $matches);
            $num     = $num % $value;
        }
        return $result;
    }
1261485
public function toRoman($number)
    {
        $number = (int)$number;
        $roman = '';
        foreach ($this->getRomanValues() as $romanValue => $numberValue) {
            $roman .= str_repeat($romanValue, floor($number / $numberValue));
            $number = $number % $numberValue;
        }
        foreach ($this->getRomanExceptions() as $replaceThis => $withThis) {
            $roman = str_replace($replaceThis, $withThis, $roman);
        }
        return $roman;
    }
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;
  }
122960
public function toFloat($num)
	{
		$dotPos = strrpos($num, '.');
		$commaPos = strrpos($num, ',');
		$sep = (($dotPos > $commaPos) && $dotPos) ? $dotPos : ((($commaPos > $dotPos) && $commaPos) ? $commaPos : false);

		if (!$sep) {
			return floatval(preg_replace('/[^0-9]/', '', $num));
		}

		return floatval(
			preg_replace('/[^0-9]/', '', substr($num, 0, $sep)) . '.' .
			preg_replace('/[^0-9]/', '', substr($num, $sep+1, strlen($num)))
		);
	}
1147979
def toRoman(num):
    """"""
    if not 0 < num < 5000:
        raise ValueError("number %n out of range (must be 1..4999)", num)
    if int(num) != num:
        raise TypeError("decimals %n can not be converted", num)

    result = ""
    for numeral, integer in romanNumeralMap:
        while num >= integer:
            result += numeral
            num -= integer
    return result
457486
public function set_num_format($num_format) {
        $numbers = array();

        $numbers[1] = '0';
        $numbers[2] = '0.00';
        $numbers[3] = '#,##0';
        $numbers[4] = '#,##0.00';
        $numbers[11] = '0.00E+00';
        $numbers[12] = '# ?/?';
        $numbers[13] = '# ??/??';
        $numbers[14] = 'mm-dd-yy';
        $numbers[15] = 'd-mmm-yy';
        $numbers[16] = 'd-mmm';
        $numbers[17] = 'mmm-yy';
        $numbers[22] = 'm/d/yy h:mm';
        $numbers[49] = '@';

        if ($num_format !== 0 and in_array($num_format, $numbers)) {
            $this->format['numberformat']['code'] = $num_format;
        }

        if (!isset($numbers[$num_format])) {
            return;
        }

        $this->format['numberformat']['code'] = $numbers[$num_format];
    }
1352893
private function encodeSignedNumber($num)
    {
        $sgn_num = $num << 1;
        if ($num < 0) {
            $sgn_num = ~($sgn_num);
        }
        return $this->encodeNumber($sgn_num);
    }
438965
public static function ordinal($num)
	{
		$ext = 'th';
		if ($num < 11 || $num > 13) {
			switch ($num % 10) {
				case 1:
					$ext = 'st';
					break;
				case 2:
					$ext = 'nd';
					break;
				case 3:
					$ext = 'rd';
			}
		}
		return $num.$ext;
	}
946887
public static function toInt($roman)
    {
        if (!preg_match('`[MDCLXVI]+`', strtoupper($roman))) {
            throw new \InvalidArgumentException("$roman is an invalid roman numeral.");
        }
        $roman = strtoupper($roman);

        $characters = array_flip(self::$characters);

        $int = 0;
        while (strlen($roman) > 0) {
            if (isset($characters[substr($roman, 0, 2)])) {
                $int += $characters[substr($roman, 0, 2)];
                $roman = substr($roman, 2);
                continue;
            }
            if (isset($characters[substr($roman, 0, 1)])) {
                $int += $characters[substr($roman, 0, 1)];
                $roman = substr($roman, 1);
                continue;
            }
        }

        return $int;
    }
607845
public function set_num_format($num_format) {

        $numbers = array();

        $numbers[1] = '0';
        $numbers[2] = '0.00';
        $numbers[3] = '#,##0';
        $numbers[4] = '#,##0.00';
        $numbers[11] = '0.00E+00';
        $numbers[12] = '# ?/?';
        $numbers[13] = '# ??/??';
        $numbers[14] = 'mm-dd-yy';
        $numbers[15] = 'd-mmm-yy';
        $numbers[16] = 'd-mmm';
        $numbers[17] = 'mmm-yy';
        $numbers[22] = 'm/d/yy h:mm';
        $numbers[49] = '@';

        if ($num_format !== 0 and in_array($num_format, $numbers)) {
            $flipped = array_flip($numbers);
            $this->properties['num_format'] = $flipped[$num_format];
        }
        if (!isset($numbers[$num_format])) {
            return;
        }

        $this->properties['num_format'] = $num_format;
    }
385823
private function get_original_string($num) {
        $length = $this->table_originals[$num * 2 + 1];
        $offset = $this->table_originals[$num * 2 + 2];
        if (!$length)
            return '';
        fseek($this->STREAM, $offset);
        $data = fread($this->STREAM, $length);
        return (string)$data;
    }
781727
protected function readIntegerList($num)
    {
        if ($this->littleEndian) {
            return unpack('V' . $num, fread($this->file, 4 * $num));
        }

        return unpack('N' . $num, fread($this->file, 4 * $num));
    }
1061347
public static function lowerAlpha(int $num): string
    {
        $alpha = static::upperAlpha($num);

        return StringHelper::toLowerCase($alpha);
    }
368744
function (num) {
      var s = '';

      while (num >= 0) {
        s = String.fromCharCode(num % 26 + 97) + s;
        num = Math.floor(num / 26) - 1;
      }

      return s.toUpperCase();
    }
1044447
private function numeric($num): void
    {
        //调节为整数
        $num = intval(round($num));

        //与id字段匹配
        $this->sql = " id=$num";
        $this->prepare = " id=?";
        $this->param = [$num];
    }
22882
protected function decb64($num)
    {
        $bytes = array();
        while($num) {
            array_unshift($bytes, $this->mod($num, 256));
            $num = $this->div($num, 256);
        }
        
        if($bytes && $bytes[0] > 127) {
            array_unshift($bytes,0);
        }
        
        array_unshift($bytes, 'C*');
        
        return base64_encode(call_user_func_array('pack', $bytes));
    }
946794
private static function utf8($num) {
    if ($num <=     0x7F) return chr($num);
    if ($num <=    0x7FF) return chr(($num >>  6) + 192) . chr(( $num        & 63) + 128);
    if ($num <=   0xFFFF) return chr(($num >> 12) + 224) . chr((($num >>  6) & 63) + 128) . chr(( $num       & 63) + 128);
    if ($num <= 0x1FFFFF) return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
    return '';
  }