Thank you, that was it.  I needed to test the variable against both an
integer and a string, so I ended up using (string) when I need to
compare a string.  Rest of the time, it's an integer.

Robin

Rasmus Lerdorf wrote:
> 
> > 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]

-- 
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]

Reply via email to