|
Posted by Justin Koivisto on 11/29/05 22:34
Sean wrote:
> See the differece if you use ===
>
> <?
> $name="henk";
>
> echo "\$name=$name <br>";
> echo "(int)\$name=".(int)$name."<br>";
>
> if ($name === (int)$name){
> echo "equal";
> } else {
> echo "Not equal";
> }
>
> ?>
>
> http://php.net/operators.comparison
>
But be careful with this...
$i="4";
if($i === intval($i)){
// this will not happen
}
Also keep in mind that values that are supplied via _GET, _POST, _COOKIE
are strings, not their representative types...
Therefore:
call page: page.php?i=4
if($_GET['i'] === intval($_GET['i'])){
// this will not happen
}
--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com
Navigation:
[Reply to this message]
|