…, PHP just brought me a new definition of “portable” – and that was when working with… integers. PHP is not able to handle unsigned integers, and… them as integers, you’re in trouble. Oh wait, no – that’s on 32-bit platforms only! PHP int size is platform-dependent… 2007 now but there’s no native 64-bit integer type in PHP. Let me remind that built-in “int” might be…
Post: PHP vs. BIGINT vs. float conversion caveat
… had already written about the mess that 64-bit integers are in PHP. But if the numbers you use do not cover… is that PHP floats are in fact doubles, i.e. double-precision 64-bit numbers. They have 52 bits for mantissa, and integer… As you can see float to string conversion is not portable across systems and PHP versions. So if you’re handling large…
Post: MySQL automatic data truncation can backfire
… disk. So far so good. The problem I discovered however is some of these queries would take enormous amount of time… PHP and MySQL are both to blame. PHP is to blame because in 32bit PHP version result of crc32() function was returned as signed integer, in 64bit build of same PHP version…
Comment: Speeding up GROUP BY if you want aproximate results
CRC32 in PHP is crazy in the sense it gives results on 32bit and … your case casting as BINARY you should get string which is slower. Typically just CRC32 should work. Your high collision rate… because it was running into the wall with max signed integer. What MySQL version is this ?
Comment: Shard-Query turbo charges Infobright community edition (ICE)
….php but i can not read data using read.php i print ‘php read.php‘ in command line output show program is blocked why? output: PHP… used as offset, casting to integer (28) in /usr/local/lib/php/Net/Gearman/Client.php on line 169 PHP Strict Standards: Resource ID… used as offset, casting to integer (28) in /usr/local/lib/php/Net/Gearman/Client.php on line 173 PHP Strict Standards: Resource ID…
Comment: Integers in PHP, running with scissors, and portability
… and 64 bit machines in parallel. In PHP, the variable size of the integer type is a “feature” (probably the developers wanted to…://www.php.net/manual/en/language.types.integer.php: “The size of an integer is platform-dependent, although a maximum value of about two billion is the usual value (that’s 32 bits signed). PHP does…
Comment: PHP vs. BIGINT vs. float conversion caveat
….php.net/package/big_int It is relatively fast (given that you have a php function call on each op). About php and large integers, it never supported anything else than 32bits integer. Whether the integer was stored in the system default integer (64bits…
Comment: PHP vs. BIGINT vs. float conversion caveat
… mentioned conversion TO string, in bold. > in both cases float is expected to lose its precision No, it’s not. It… php.net/float by the way). Doubles have 52 bits allocated for mantissa, which means that 52-bit (actually 53-bit) INTEGER values MUST be stored without ANY precision loss. > PHP tries to handle this in a…
Comment: MySQL automatic data truncation can backfire
… checked, the problem is not the conversion to string, but the fact 64bit php returns a 64 bit signed integer which wont wrap at the same position as a 32bit signed integer. I’ve solved my problems by using sprintf(‘%u’,crcvalue) when crcvalue is negative and then store…
Comment: PHP vs. BIGINT vs. float conversion caveat
… had already written about the mess that 64-bit integers are in PHP. But if the numbers you use do not cover 64-bit range fully, floats might save the day. The trick is that PHP floats are in fact doubles, i.e. double-precision…

