note 76171 added to language.operators.comparison
| From: | rofthorax at gmail dot com | Date: | Tue, 03 Jul 2007 20:57:10 +0000 |
| Subject: | note 76171 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128199@lists.php.net to get a copy of this message | ||
I'm sure others have found this out, but there is no excuse for it:
$a = "woiejiowjef";
$b = 0;
print ($a == $b); // results in 1
print ("$a" == "$b"); // results in 0
When did PHP get to be strongly typed? And if you
think going to an object oriented system is going to save face. I have news for you, what is
operator overloading anyhow? It's polymorphism by the purest sense.. Why then does php make
such a terrible error? It's like we are back using C, comparing a string pointer to a integer.
If addressing in relative, a string pointing to address 0 is equivalent to the number 0. But
perceptively, this is wrong because we don't have access (or are not supposed to have access)
to pointers.
----
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/76171
Del: integrated -- https://master.php.net/note/delete/76171/integrated
Del: useless -- https://master.php.net/note/delete/76171/useless
Del: bad code -- https://master.php.net/note/delete/76171/bad+code
Del: spam -- https://master.php.net/note/delete/76171/spam
Del: non-english -- https://master.php.net/note/delete/76171/non-english
Del: in docs -- https://master.php.net/note/delete/76171/in+docs
Del: other reasons-- https://master.php.net/note/delete/76171
Reject -- https://master.php.net/note/reject/76171
Search -- https://master.php.net/manage/user-notes.php