On Thu, 03 Jun 2010 17:25:53 +0100, Josh Davis <php...@gmail.com> wrote:
On 1 June 2010 20:43, Stas Malyshev <smalys...@sugarcrm.com> wrote:
It is very frequent that you want number and get "1" instead - almost
all incoming data for PHP are strings.
I'd like to point out that filter_input() does cast user input to the
right PHP type. And if memory serves, ext/filter is meant to be PHP's
standard way of handling user input. So in terms of incoming data, I'd
consider user input being covered already.
The only other big source of data is the database. [...]
User input and databases are certainly not the only sources of incoming
data – think for instance about (possibly already dtd/schema validated)
XML.
Another example with dates:
$d1 = new DateTime("2010-06-01");
$d2 = new DateTime("2010-07-01");
my_func($d1->format("w"));
my_func2($d2->diff($d1)->format("%d"));
I'm sure it wouldn't be hard to find other examples outside form
submissions and databases.
--
Gustavo Lopes
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php