PHP vs Python pack format comparation

Differences between PHP and Python pack/unpack format characters

phppython
NUL-padded stringa
SPACE-padded stringA
Hex string, low nibble firsth
Hex string, high nibble firstH
signed charcbsigned char
unsigned charCBunsigned char
signed short (always 16 bit, machine byte order)shshort
unsigned short (always 16 bit, machine byte order)SHunsigned short
unsigned short (always 16 bit, big endian byte order)niint
unsigned short (always 16 bit, little endian byte order)vIunsigned int
signed integer (machine dependent size and byte order)iiint
unsigned integer (machine dependent size and byte order)IIunsigned int
signed long (always 32 bit, machine byte order)lllong
unsigned long (always 32 bit, machine byte order)LLunsigned long
unsigned long (always 32 bit, big endian byte order)N
unsigned long (always 32 bit, little endian byte order)V
signed long long (always 64 bit, machine byte order)qqlong long
unsigned long long (always 64 bit, machine byte order)QQunsigned long long
unsigned long long (always 64 bit, big endian byte order)J
unsigned long long (always 64 bit, little endian byte order)P
float (machine dependent size and representation)fffloat
float (machine dependent size, little endian byte order)g
float (machine dependent size, big endian byte order)G
double (machine dependent size and representation)dddouble
double (machine dependent size, little endian byte order)e
double (machine dependent size, big endian byte order)E
NUL bytex
Back up one byteX
NUL-padded string (new in PHP 5.5)Z
NUL-fill to absolute position@
xpad byte
cchar
?_Bool
schar[]
pchar[]
Pvoid *
This entry was posted in Informacione tehnologije, Programiranje and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.