|
Posted by Richard Lynch on 10/04/04 11:05
Chadwick, Russell wrote:
>
> The function this is from sometimes uses $_POST or $_GET input, so
> sometimes its comparing 1337 with '1337' and === would break that.
>
> so I'll have to use something like:
>
> if (($value == $curval) && !(is_string ($curval) && ($value == 0)))
>
> unless there is a better way
Hard to say, without knowing what the function is, what it's supposed to
do, who's calling it and why/when/where...
I'll take a wild stab at it, though, and suggest that if you care about
data types that much, then you should be converting your $_GET/$_POST to
(int) in the first place.
Plus, you should be converting your $_GET/$_POST data to (int) when
appropriate for your data scrubbing (security).
So, really, you should have:
<?php
$curval = (int) (isset($_GET['curval']) ? $_GET['curval'] : 0);
...
your_function(1337, $curval);
...
?>
Then you can use === in your function safely.
--
Like Music?
http://l-i-e.com/artists.htm
[Back to original message]
|