> If you set $qty=0; then $qty has no value.
Of course it has a value. The value is 0.
Quite distinct from not having a value, or in proper terms, not being set.
Try this:
var_dump($qty);
$qty = 0;
var_dump($qty);
Well, I will save you the trouble, it outputs:
NULL
int(0)
> Type casting is irrelevant in php.
No they aren't. Try this:
$qty = 0;
if($qty=="test") echo "foo";
if((string)$qty=="test") echo "bar";
This will only output "foo". Not "bar". You could also use the ===
operator to force PHP to check not only the value but also the type.
See http://www.php.net/manual/en/language.operators.comparison.php
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]