|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests |
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 22 07:00:01 2025 UTC |
Description: ------------ pack() and unpack() are very useful functions, but would be nice to have a machine independent support for signed numbers, especially signed 32-bit little endian. If there are code alread for this, then they only missing from the documentation. Test script: --------------- // Let's say, "E" would mean 32-bit signed little endian echo unpack("E","A\xE2\x82\xAC")[1]."\n"; //PHP 5.4 syntax, would give back always -1400708543, regardless of architecture endianness (same az "l" on little endian system). echo pack("E",-1400708543)."\n"; //would give back A€ on a UTF-8 terminal, same as "l" on a little endian system Expected result: ---------------- -1400708543 A€ Actual result: -------------- unknown format code