@@ 1496-1510 (lines=15) @@ | ||
1493 | * |
|
1494 | * @return string |
|
1495 | */ |
|
1496 | public static function HEXTOBIN($x, $places = null) |
|
1497 | { |
|
1498 | $x = Functions::flattenSingleValue($x); |
|
1499 | $places = Functions::flattenSingleValue($places); |
|
1500 | ||
1501 | if (is_bool($x)) { |
|
1502 | return Functions::VALUE(); |
|
1503 | } |
|
1504 | $x = (string) $x; |
|
1505 | if (strlen($x) > preg_match_all('/[0123456789ABCDEF]/', strtoupper($x), $out)) { |
|
1506 | return Functions::NAN(); |
|
1507 | } |
|
1508 | ||
1509 | return self::DECTOBIN(self::HEXTODEC($x), $places); |
|
1510 | } |
|
1511 | ||
1512 | /** |
|
1513 | * HEXTODEC. |
|
@@ 1652-1666 (lines=15) @@ | ||
1649 | * |
|
1650 | * @return string |
|
1651 | */ |
|
1652 | public static function OCTTOBIN($x, $places = null) |
|
1653 | { |
|
1654 | $x = Functions::flattenSingleValue($x); |
|
1655 | $places = Functions::flattenSingleValue($places); |
|
1656 | ||
1657 | if (is_bool($x)) { |
|
1658 | return Functions::VALUE(); |
|
1659 | } |
|
1660 | $x = (string) $x; |
|
1661 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
|
1662 | return Functions::NAN(); |
|
1663 | } |
|
1664 | ||
1665 | return self::DECTOBIN(self::OCTTODEC($x), $places); |
|
1666 | } |
|
1667 | ||
1668 | /** |
|
1669 | * OCTTODEC. |
|
@@ 1744-1759 (lines=16) @@ | ||
1741 | * |
|
1742 | * @return string |
|
1743 | */ |
|
1744 | public static function OCTTOHEX($x, $places = null) |
|
1745 | { |
|
1746 | $x = Functions::flattenSingleValue($x); |
|
1747 | $places = Functions::flattenSingleValue($places); |
|
1748 | ||
1749 | if (is_bool($x)) { |
|
1750 | return Functions::VALUE(); |
|
1751 | } |
|
1752 | $x = (string) $x; |
|
1753 | if (preg_match_all('/[01234567]/', $x, $out) != strlen($x)) { |
|
1754 | return Functions::NAN(); |
|
1755 | } |
|
1756 | $hexVal = strtoupper(dechex(self::OCTTODEC($x))); |
|
1757 | ||
1758 | return self::nbrConversionFormat($hexVal, $places); |
|
1759 | } |
|
1760 | ||
1761 | /** |
|
1762 | * COMPLEX. |