code: public static function OCTTODEC($x)
      {
          $x = Functions::flattenSingleValue($x);
  
          if (is_bool($x)) {
              return Functions::VALUE();
          }
          $x = (string) $x;
          if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) {
              return Functions::NAN();
          }
          $binX = '';
          foreach (str_split($x) as $char) {
              $binX .= str_pad(decbin((int) $char), 3, '0', STR_PAD_LEFT);
          }
          if (strlen($binX) == 30 && $binX[0] == '1') {
              for ($i = 0; $i < 30; ++$i) {
                  $binX[$i] = ($binX[$i] == '1' ? '0' : '1');
              }
  
              return (bindec($binX) + 1) * -1;
          }
  
          return bindec($binX);
      }
docs: OCTTODEC.
  
  Return an octal value as decimal.
  
  Excel Function:
  OCT2DEC(x)
  
  @category Engineering Functions
  
  @param string $x The octal number you want to convert. Number may not contain
  more than 10 octal characters (30 bits). The most significant
  bit of number is the sign bit. The remaining 29 bits are
  magnitude bits. Negative numbers are represented using
  two's-complement notation.
  If number is not a valid octal number, OCT2DEC returns the
  #NUM! error value.
  
  @return string