On 6/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Paweł Stradomski wrote:
> [EMAIL PROTECTED] wrote:
>
>> Dear internals,
>>
>> I stumbled upon the following odd error message from PHP which I was not
>> expecting.
>>   function test(){
>>     echo $this == $this->c1->c2?'equals':'not equals'; // Somehow this
>>
>
> Use === (shallow test - returns true iff the variables refer to the same
> instance) instead of == (deep comparision - member-by-member).
>
Still in theory it should not produce an error.

Yes, it should. == is going to test all the properties of the object
against each other. So to compare.

$this == $this->c1->c2, it will compare
$this->c1 == $this->c1->c2->c1, which will in turn compare
$this->c1->c2 == $this->c1->c2->c1->c2, which in turn compares
$this->c1->c2->c1 == $this->c1->c2->c1->c2->c1

And so on.

--
--Robert Deaton

Reply via email to