chbo() public static method

Change the byte order of a number. Used to allow big endian machines to decode the timezone blobs, which are encoded in little endian order.
public static chbo ( integer $num ) : integer
$num integer The number to reverse.
return integer The number, in the reverse byte order.
Beispiel #1
0
 /**
  * Build an MAPI TZ blob given a TZ Offset hash.
  *
  * @param array $offsets  A TZ offset hash
  *
  * @return string  A base64_encoded MAPI Timezone structure suitable
  *                 for transmitting via wbxml.
  */
 public static function getSyncTZFromOffsets(array $offsets)
 {
     if (!Horde_Mapi::isLittleEndian()) {
         $offsets['bias'] = Horde_Mapi::chbo($offsets['bias']);
         $offsets['stdbias'] = Horde_Mapi::chbo($offsets['stdbias']);
         $offsets['dstbias'] = Horde_Mapi::chbo($offsets['dstbias']);
     }
     $packed = pack('la64vvvvvvvvla64vvvvvvvvl', $offsets['bias'], '', 0, $offsets['stdmonth'], $offsets['stdday'], $offsets['stdweek'], $offsets['stdhour'], $offsets['stdminute'], $offsets['stdsecond'], $offsets['stdmillis'], $offsets['stdbias'], '', 0, $offsets['dstmonth'], $offsets['dstday'], $offsets['dstweek'], $offsets['dsthour'], $offsets['dstminute'], $offsets['dstsecond'], $offsets['dstmillis'], $offsets['dstbias']);
     return base64_encode($packed);
 }