Re: unpack question
| From: | John J Foerch | Date: | Fri, 05 Dec 2003 14:41:18 +0000 |
| Subject: | Re: unpack question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171991@lists.php.net to get a copy of this message | ||
Thanks. Neat trick with the printf command. I'll use that for now.
John
> I suppose it is a bug. It seems that all unsigned unpacks dont
> honor this, as the documentation on unpack does note.
>
> I did, however, write a patch that will enable the returning of
> unsigned values. It still needs approval and is currently only for
> the cvs version of php:
>
> http://zirzow.dyndns.org/patches/pack.patch
>
> A work around on this is you'll have to use s/printf() to obtain the
> correct unsigned value:
>
> $array = unpack('Llongvalue', -1);
> printf("%lu", $array['longvalue']);