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QlZs|e/'YJ#yieҮv!,@nim6L# 6ex#Vj4C έ6A 2oQ%E]Ҡ,4Rs;1vEpz' فU mi.*-3a*B|uDOᒶEHbLqbRM3쓶yVTc(񷺹i^Ooc1'29ŏEK?CFp.2X֙VʶIζλW0հ'^; p@' Ma!l٬B5CT|00忬Ow-yOxǡeKy{7LO.256;9hKf9y bP&JSϏ5Iqi7?tJ6i'~X/TZCSU-/ Y(Y?.BEI%q&z_kZ{-y|!a @ s wI\8~#SFKTL&<5Ff=o[I3`̎+ZsO{˿#eA*:wp]S|P9*x|nB?ͦzE`|?m2Vu!i_:UNx8 >xϦu=DfG}HN) ĢQ$3pS0d c}'/tی ~y EdM%*x|nB?͐5mߨ}*<9+:F&%($nsccW}w ĢQ$3|/^&;ϫKO=cK0̈;!p'y+K>v} @'Rؙ">ߴ%ijhWJ ZW|7/aliꃜǸ E;@O ŰOLqM"TG/0 ORg碀ۜNpn/XpzF:s,mKݫ;NHM܈?Gr*6HSU]Hz3_6xE\ng`9\937H.O[lf::validateValue($value); $value = self::validateOctal($value); } catch (Exception $e) { return $e->getMessage(); } $binX = ''; foreach (str_split($value) 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 (string) ((bindec($binX) + 1) * -1); } return (string) bindec($binX); } /** * toHex. * * Return an octal value as hex. * * Excel Function: * OCT2HEX(x[,places]) * * @param array|string $value 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 negative, OCT2HEX ignores places and returns a * 10-character hexadecimal number. * If number is not a valid octal number, OCT2HEX returns the * #NUM! error value. * If OCT2HEX requires more than places characters, it returns * the #NUM! error value. * Or can be an array of values * @param array|int $places The number of characters to use. If places is omitted, OCT2HEX * uses the minimum number of characters necessary. Places is useful * for padding the return value with leading 0s (zeros). * If places is not an integer, it is truncated. * If places is nonnumeric, OCT2HEX returns the #VALUE! error value. * If places is negative, OCT2HEX returns the #NUM! error value. * Or can be an array of values * * @return array|string Result, or an error * If an array of numbers is passed as an argument, then the returned result will also be an array * with the same dimensions */ public static function toHex($value, $places = null) { if (is_array($value) || is_array($places)) { return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $places); } try { $value = self::validateValue($value); $value = self::validateOctal($value); $places = self::validatePlaces($places); } catch (Exception $e) { return $e->getMessage(); } $hexVal = strtoupper(dechex((int) self::toDecimal($value))); $hexVal = (PHP_INT_SIZE === 4 && strlen($value) === 10 && $value[0] >= '4') ? "FF{$hexVal}" : $hexVal; return self::nbrConversionFormat($hexVal, $places); } protected static function validateOctal(string $value): string { $numDigits = (int) preg_match_all('/[01234567]/', $value); if (strlen($value) > $numDigits || $numDigits > 10) { throw new Exception(ExcelError::NAN()); } return $value; } }