Re: = 0 and = "0"
| From: | Kodrik | Date: | Thu, 25 Oct 2001 05:40:09 +0000 |
| Subject: | Re: = 0 and = "0" | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72212@lists.php.net to get a copy of this message | ||
<? $qty = "0" ; if ($qty != "test") print ("qty is not test");
?>
<? $qty = 0 ; if ($qty != "test") printf("qty is not test"); ?>
I just tested those two lines with php 4.0.6 and they both work.
There is a difference though.
If you set $qty=0; then $qty has no value.
But if you set $qty="0", it has a value.
Type casting is irrelevant in php.