note 13868 deleted from function.ord by danbrown
| From: | danbrown@php.net | Date: | Tue, 11 Oct 2011 16:18:46 +0000 |
| Subject: | note 13868 deleted from function.ord by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183814@lists.php.net to get a copy of this message | ||
Note Submitter: theanimus at btconnect dot com
----
[Ed: bindec() does this for you... it only doesn't get the sign-bit. Your solution will result
in a float with the sign is set!
http://www.php.net/bindec
--jeroen ]
Erm this one took me a while to work out, in the end a friend told me, if ur working out the value
of an 32bit integer ($data) then this is 4 u ;-)
$num=ord($data[0])+(ord($data[1])<<8)+(ord($data[2])<<16)+(ord($data[3])<<24);
if ($num>=4294967294){
$num-=4294967296;
}