aspegicus
asked on
php binary file writing with pack() function : need to inverse byte order !
I have an issue writting binary files in php. I need to write the following 4 bytes Hex codes in a file (on intel) : 1000 2E00 0068 7474 703A
I do : pack('H*','10002E000068747 4703A') and expect to have same in my binary file doing an hexdump but I get instead 0010 002E 6800 7474 3A70
What can I do to reverse those bytes?
I do : pack('H*','10002E000068747
What can I do to reverse those bytes?
ASKER
Simply because pack('h*','10002E000068747 4703A') writes 0001 00e2 8600 4747 a307 not what I need..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Right on! It was hexdump on linux that is displaying the sequence of bytes in reverse order compared to xvi32 under Windows. I'm all set.
h Hex string, low nibble first
H Hex string, high nibble first
Why will not You try lower H then?