Re: Type hinting

From: Date: Thu, 03 Jun 2010 21:21:46 +0000
Subject: Re: Type hinting
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  Groups: php.internals 
Request: Send a blank email to internals+get-48631@lists.php.net to get a copy of this message
On 3 June 2010 22:24, Gustavo Lopes <glopes@nebm.ist.utl.pt> wrote: > On Thu, 03 Jun 2010 17:25:53 +0100, Josh Davis <phpwnd@gmail.com> wrote: > >> The only other big source of data is the database. [...] Emphasis on "big." There's an infinite number of sources (from mashups using XML or JSON to XML-RPC servers or weird setups processing CSV files), some of them can be/are typed, others are not. The two big sources of incoming data are user input and databases, though. And remember that I was only discussing it in response to the claim that "almost all incoming data for PHP are strings." My point was that user input will be correctly typed if you validate it with PHP's bundled extension, as it is commonly recommended, and it's also becoming increasingly easy to get correctly typed data from your database thanks to mysqlnd. Of course it doesn't mean that you won't find some rarer situations where you get strings in place of integers, e.g. if you're reading from a CSV or XML file, or from a database that only uses a text protocol. -JD

« previous php.internals (#48631) next »