>> I'm not so sure about that. In a well-written web application, you
>> would
>> typically convert them on the first layer, when receiving from the
>> web.
>> On next usages, your int variables are usually ints already.

Afraid not.

It turns out that PHP, on 32-bit hardware, converting large BIGINT
using (int) $ID ends up as a negative number, and then when you pass
it in to the database if a string query, you get a negative ID, not at
all what was intended.

(Been there, done that, got burned)

At least, that's been my experience with some versions of PHP and some
database drivers.

So at least the database IDs have to remain as strings, if you are
using BIGINT.

You could, of course, only convert the values known to be in range of
PHPs positive integers, and leave the others as strings.

This is just a simple example of how the super strict typing simply
doesn't work out too well in PHP.

-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to