Marek Kilimajer wrote:
http://www.php.net/pack
A little background on what Im doing. Im attempting to read realaudio files for their metadata, so Im reading from a binary string,
and Im currently using unpack() (Im new to using this function, so I may be wrong with its usage) to unpack the data, along with ord(),
and the result is something like what I posted before -> 0 0 0 18 (I put the spaces in there so we know that each number is a byte)
So Im not exactly sure how the pack() function would play a role in this.
David Nicholson wrote:
Never heard of a BigEndian number beofre, but this should do it...
function BigEndiantoInt($bigendian){
$bits = split(" ",$bigendian);
$bits = array_reverse($bits);
$value = 0; $columnvalue = 1;
foreach($bits as $thisbit){
$value = $value + ($columnvalue * $thisbit);
$columnvalue = $columnvalue * 2; }
return $value;
}
For taste of what BigEndian or its counterpart LittleEndian is about, look at ->
http://www.webopedia.com/TERM/B/big_endian.html
http://whatis.techtarget.com/definition/0,,sid9_gci211659,00.html
I'll give your function a shot, and see if I can get something meaningful from it.
Thanks.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php