Posted by Jason Morehouse on 10/01/24 11:05
Russell Chadwick wrote:
>
> Could anyone tell me why this code echos?
>
> <?php
> $value = 0;
> $curval = 'A';
> if ($value == $curval) {
> echo "WTH, Over<br>";
> }
> ?>
$value = 0 means false. And your comparison is false. Try:
<?php
$value = '0';
$curval = 'A';
if ($value == $curval) {
echo "WTH, Over<br>";
}
# OR
$value = 0;
$curval = 'A';
if ($value === $curval) {
echo "WTH, Over<br>";
}
?>
?>
--
Jason Morehouse
Vendorama - Create your own online store
http://www.vendorama.com
[Back to original message]
|