swguy:
Do you know what this program outputs?
<?php
$i = 0;
$j = 'test string';
if ($i == $j) {
echo 'equal';
} else {
echo 'not equal';
}
```
>
> This is how PHP works. Complaining is futile, as this developer discovered:
> <https://bugs.php.net/bug.php?id=39579>
Personally I don't see why this is being called a bug. If you think about it, it doesn't make sense to compare a number variable with a string variable in the first place, so even if any given programming language does allow it (such as PHP) the results will be somewhat unpredictable. Most programming languages will treat/trap this as an error.
As much as I like PHP, I find that it's not a good programming language to learn from, simply because it **does** allow loose typecasting, which teaches bad coding habits that will invariably cause this type of unexpected behaviour at times.
Just my 2cents worth.
Cheers
Rod