Re: Data Types Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Lynch wrote:
> By definition, all HTTP data is of type 'string' because that's the
> ONLY data type HTTP supports.
> 
> PHP will cheerfully typecast it to whatever it needs to be later, but
> when it first comes in from the GET (or POST or COOKIE or whatever)
> data, it's going to start its life as a string, no matter how it
> looks.
> 
> If you *know* it should be integer, typecast it as you get it:
> 
> $foo = (int) $_GET['foo'];
> 
> Do this to a) self-document your code, b) foil a ton of web-bots and
> nasty people trying to cram the wrong kind of data into your
> application to break/abuse it.
>

you forgot c.

c) because it's what all the cool kids do.

actually forget c. cool kids aren't writing code, they're all
smoking crack, driving 100,000 dollar cars and pimping out college girls.

here's hoping your day is better than mine :-P

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux