note 111178 added to function.hexdec

From: Date: Wed, 23 Jan 2013 01:12:15 +0000
Subject: note 111178 added to function.hexdec
Groups: php.notes 
Request: Send a blank email to php-notes+get-193351@lists.php.net to get a copy of this message
The trick with number_format did not work for me, but the one below using BC Math functions dues. Like 13c54bb142cf116c = 1424628081834791276. Most online converters get this wrong too. function bchexdec($hex) { $dec = 0; $len = strlen($hex); for ($i = 1; $i <= $len; $i++) { $dec = bcadd($dec, bcmul(strval(hexdec($hex[$i - 1])), bcpow('16', strval($len - $i)))); } return $dec; } This is from: http://stackoverflow.com/questions/1273484/large-hex-values-with-php-hexdec ---- Server IP: 69.147.83.199 Probable Submitter: 78.131.24.196 ---- Manual Page -- http://php.net/manual/en/function.hexdec.php Edit -- https://master.php.net/note/edit/111178 Del: integrated -- https://master.php.net/note/delete/111178/integrated Del: useless -- https://master.php.net/note/delete/111178/useless Del: bad code -- https://master.php.net/note/delete/111178/bad+code Del: spam -- https://master.php.net/note/delete/111178/spam Del: non-english -- https://master.php.net/note/delete/111178/non-english Del: in docs -- https://master.php.net/note/delete/111178/in+docs Del: other reasons-- https://master.php.net/note/delete/111178 Reject -- https://master.php.net/note/reject/111178 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#193351) next »