note 80914 added to function.unpack
| From: | ShawnKelly at osu1 dot php dot net | Date: | Wed, 06 Feb 2008 20:14:00 +0000 |
| Subject: | note 80914 added to function.unpack | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135825@lists.php.net to get a copy of this message | ||
Above it says this:
"Note that PHP internally stores integral values as signed. If you unpack a large unsigned
long and it is of the same size as PHP internally stored values the result will be a negative number
even though unsigned unpacking was specified."
This happened to me. I wanted to get a big number from a unsigned long, but it kept coming
returning a negative. Happened to notice that sprintf('%u',$dta) will take the useless
negative and restore it into its large unsigned proper magnitude.
Hope this saves someone a little time...
----
Server IP: 209.41.74.194
Probable Submitter: 198.176.170.4
----
Manual Page -- http://www.php.net/manual/en/function.unpack.php
Edit -- https://master.php.net/note/edit/80914
Del: integrated -- https://master.php.net/note/delete/80914/integrated
Del: useless -- https://master.php.net/note/delete/80914/useless
Del: bad code -- https://master.php.net/note/delete/80914/bad+code
Del: spam -- https://master.php.net/note/delete/80914/spam
Del: non-english -- https://master.php.net/note/delete/80914/non-english
Del: in docs -- https://master.php.net/note/delete/80914/in+docs
Del: other reasons-- https://master.php.net/note/delete/80914
Reject -- https://master.php.net/note/reject/80914
Search -- https://master.php.net/manage/user-notes.php