original_string: public static function dec2roman($num)
      {
  
          static $ones = array("", "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix");
          static $tens = array("", "x", "xx", "xxx", "xl", "l", "lx", "lxx", "lxxx", "xc");
          static $hund = array("", "c", "cc", "ccc", "cd", "d", "dc", "dcc", "dccc", "cm");
          static $thou = array("", "m", "mm", "mmm");
  
          if (!is_numeric($num)) {
              throw new Exception("dec2roman() requires a numeric argument.");
          }
  
          if ($num > 4000 || $num < 0) {
              return "(out of range)";
          }
  
          $num = strrev((string)$num);
  
          $ret = "";
          switch (mb_strlen($num)) {
              /** @noinspection PhpMissingBreakStatementInspection */
              case 4:
                  $ret .= $thou[$num[3]];
              /** @noinspection PhpMissingBreakStatementInspection */
              case 3:
                  $ret .= $hund[$num[2]];
              /** @noinspection PhpMissingBreakStatementInspection */
              case 2:
                  $ret .= $tens[$num[1]];
              /** @noinspection PhpMissingBreakStatementInspection */
              case 1:
                  $ret .= $ones[$num[0]];
              default:
                  break;
          }
  
          return $ret;
      }
code: public static function dec2roman($num)
      {
  
          static $ones = array("", "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix");
          static $tens = array("", "x", "xx", "xxx", "xl", "l", "lx", "lxx", "lxxx", "xc");
          static $hund = array("", "c", "cc", "ccc", "cd", "d", "dc", "dcc", "dccc", "cm");
          static $thou = array("", "m", "mm", "mmm");
  
          if (!is_numeric($num)) {
              throw new Exception("dec2roman() requires a numeric argument.");
          }
  
          if ($num > 4000 || $num < 0) {
              return "(out of range)";
          }
  
          $num = strrev((string)$num);
  
          $ret = "";
          switch (mb_strlen($num)) {
              /** @noinspection PhpMissingBreakStatementInspection */
              case 4:
                  $ret .= $thou[$num[3]];
              /** @noinspection PhpMissingBreakStatementInspection */
              case 3:
                  $ret .= $hund[$num[2]];
              /** @noinspection PhpMissingBreakStatementInspection */
              case 2:
                  $ret .= $tens[$num[1]];
              /** @noinspection PhpMissingBreakStatementInspection */
              case 1:
                  $ret .= $ones[$num[0]];
              default:
                  break;
          }
  
          return $ret;
      }
code_tokens: public static function dec2roman ( $ num ) { static $ ones = array ( "" , "i" , "ii" , "iii" , "iv" , "v" , "vi" , "vii" , "viii" , "ix" ) ; static $ tens = array ( "" , "x" , "xx" , "xxx" , "xl" , "l" , "lx" , "lxx" , "lxxx" , "xc" ) ; static $ hund = array ( "" , "c" , "cc" , "ccc" , "cd" , "d" , "dc" , "dcc" , "dccc" , "cm" ) ; static $ thou = array ( "" , "m" , "mm" , "mmm" ) ; if ( ! is_numeric ( $ num ) ) { throw new Exception ( "dec2roman() requires a numeric argument." ) ; } if ( $ num > 4000 || $ num < 0 ) { return "(out of range)" ; } $ num = strrev ( ( string ) $ num ) ; $ ret = "" ; switch ( mb_strlen ( $ num ) ) { /** @noinspection PhpMissingBreakStatementInspection */ case 4 : $ ret .= $ thou [ $ num [ 3 ] ] ; /** @noinspection PhpMissingBreakStatementInspection */ case 3 : $ ret .= $ hund [ $ num [ 2 ] ] ; /** @noinspection PhpMissingBreakStatementInspection */ case 2 : $ ret .= $ tens [ $ num [ 1 ] ] ; /** @noinspection PhpMissingBreakStatementInspection */ case 1 : $ ret .= $ ones [ $ num [ 0 ] ] ; default : break ; } return $ ret ; }
docstring: Converts decimal numbers to roman numerals
  
  @param int $num
  
  @throws Exception
  @return string
docstring_tokens: Converts decimal numbers to roman numerals