note 76172 deleted from language.operators.comparison by danbrown
| From: | danbrown@php.net | Date: | Thu, 18 Jun 2009 14:04:42 +0000 |
| Subject: | note 76172 deleted from language.operators.comparison by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157066@lists.php.net to get a copy of this message | ||
Note Submitter: rofthorax at gmail dot com
----
$a = "iowjoiwef";
$b = 0;
print ($a == $b); // is 1
print ("$a" == "$b"); // is 0
Now someone mentions the point that
$y = "123";
print (int) $y; // is 123
Why would anyone want "iowjoiwef" to be 0 when casted to int? Why should int take
precedence on operator casting when comparing two values, isn't php a string oriented
language.. Is it strongly typed? What about operator overloading? Does it offer it? Really? Can we
cover up this problem? No?
If you want people making more bugs, I suggest you stick with this form of self deception..
This is bad interpreter design.. You might as well compile PHP.. Because it can't be a valid
interpreter..