…, PHP just brought me a new definition of “portable” – and that was when working with… integers. PHP is not able to handle unsigned integers… 2007 now but there’s no native 64-bit integer type in PHP. Let me remind that built-in “int” might be… this is how the following code was born. /// portably build 64bit id from 32bit hi and lo parts function _Make64 ( $hi…
Comment: Integers in PHP, running with scissors, and portability
…’s also documented on http://www.php.net/manual/en/language.types.integer.php: “The size of an integer is platform-dependent, although a… functions (http://www.php.net/manual/en/function.pack.php) as they allow you using machine dependent formats: i signed integer (machine dependent… need to share their data. Some PHP extensions or the underlying library also had issues on 64bit systems in the past, e…
Comment: PHP vs. BIGINT vs. float conversion caveat
… 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… weird: isn’t it obvious that you can’t use 64bit integer values on 32bit platform without a special library/extension? No…
Comment: PHP vs. BIGINT vs. float conversion caveat
… way floats work (surprise!). And the third thing: even though PHP tries to handle this in a crossplatform way (because it… weird: isn’t it obvious that you can’t use 64bit integer values on 32bit platform without a special library/extension? There…. Not enough for the author? — Oh, yeah, surely “designers of PHP 5 (released in 2004) type system were either not aware…
Comment: PHP vs. BIGINT vs. float conversion caveat
… 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 on amd64…
Post: MySQL automatic data truncation can backfire
… problem I found out 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…” column was defined as “int” As it was migrated to 64bit platform we got unsigned 32bit values which did not fit…
Comment: MySQL automatic data truncation can backfire
… the fact 64bit php returns a 64 bit signed integer which wont wrap at the same position as a 32bit signed integer. I’ve… is negative and then store all crc32 values as unsigned integers in mysql.
Comment: Integers in PHP, running with scissors, and portability
… way for Sphinx API. I had similar surprise moving to 64bit PHP with crc32() function which magically started to return different values… had much better approach in this regard. MySQL internal integer math was always 64bit even on 32bit platforms. This was a bit…
Comment: Integers in PHP, running with scissors, and portability
… are using has a bug, since integer overflow handling is plattform dependent in PHP. I ran php -r ‘var_dump((int)4294967296);’ on…(-1) – Linux, Intel Celeron, 32bit: int(0) – Linux, Intel Core2Duo, 64bit: int(4294967296)
Comment: Speeding up GROUP BY if you want aproximate results
CRC32 in PHP is crazy in the sense it gives results on 32bit and 64bit platforms… In your case casting as BINARY… because it was running into the wall with max signed integer. What MySQL version is this ?

