Note Submitter: jazz
Reason: integrated
----
chrisgbk: My bet is that when rune said:
>So if someone tells you that $a==$b implies $a===$b then
you can tell them no, $a=$b=INF is a counterexample.
he actually meant:
"If someone tells you that $a===$b implies $a==$b
..."
It's never been true in PHP that the equality operator (==)
implies the identity operator (===), but the reverse is
usually true. See the definition of the identity operator at
http://us2.php.net/manual/en/language.operators.co
mparison.php . Of course, this fails for INF (which is
rune's point) because INF === INF is true but INF == INF is
false (by your own argument).
This makes a certain amount of sense. If I had some function
that might return INF and I wanted to check to see if it had
returned INF, I shouldn't use
<?php
if( mightBeInf() == INF ) doSomething(); //won't work!
?>
because mathematically INF != INF. So in order to be able to
check this properly, I need to use
<?php
if( mightBeInf() === INF ) doSomething(); //will work!
?>
So assuming rune just mistyped that line, he's right.... $a
= $b = INF is a counterexample to ($a === $b) -> ($a ==
$b). But for normal (non-boundary-case-flag) values of
variables, that implication will hold.
Everyone sick of this yet?
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|