Пример #1
0
 /**
  * Returns a sequence of bytes in big endian order, it orders the string depending
  * on machine architecture (big endian or little endian).<BR>
  * 
  * Based in code from Open Sound Control (OSC) Client Library for PHP<BR>
  * Author: Andy W Schmeder &lt;andy@a2hd.com&gt;<BR>
  * Copyright 2003
  *
  * @param string string sequence of bytes to order
  * @return string big endian ordered sequence of bytes
  * @access public 
  **/
 static function orderedByteString($string)
 {
     if (ByteUtils::isLittleEndian()) {
         $orderStr = '';
         for ($i = 0; $i < strlen($string); $i++) {
             $index = strlen($string) - 1 - $i;
             $orderStr .= $string[$index];
         }
         return $orderStr;
     }
     // No conversion necessary for big-endian architecture
     return $string;
 }