note 76172 added to language.operators.comparison
| From: | rofthorax at gmail dot com | Date: | Tue, 03 Jul 2007 21:06:27 +0000 |
| Subject: | note 76172 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128200@lists.php.net to get a copy of this message | ||
$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..
----
Server IP: 208.69.120.35
Probable Submitter: 69.241.171.211
----
Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php
Edit -- https://master.php.net/note/edit/76172
Del: integrated -- https://master.php.net/note/delete/76172/integrated
Del: useless -- https://master.php.net/note/delete/76172/useless
Del: bad code -- https://master.php.net/note/delete/76172/bad+code
Del: spam -- https://master.php.net/note/delete/76172/spam
Del: non-english -- https://master.php.net/note/delete/76172/non-english
Del: in docs -- https://master.php.net/note/delete/76172/in+docs
Del: other reasons-- https://master.php.net/note/delete/76172
Reject -- https://master.php.net/note/reject/76172
Search -- https://master.php.net/manage/user-notes.php