note 69214 deleted from language.oop5.object-comparison by felipe
| From: | felipe@php.net | Date: | Sat, 15 Dec 2007 02:06:59 +0000 |
| Subject: | note 69214 deleted from language.oop5.object-comparison by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133521@lists.php.net to get a copy of this message | ||
Note Submitter: jony AT jonysk DOT net
----
"When using the comparison operator (==), object variables are compared in a simple manner,
namely: Two object instances are equal if they have the same attributes and values, and are
instances of the same class."
Actually, it doesn't matter if they have different values:
<?php
/* ... */
$o = new Flag();
$p = new Flag(10);
/* ... */
echo "Two instances of the same class\n";
compareObjects($o, $p);
?>
output:
Two instances of the same class
o1 == o2 : TRUE
o1 != o2 : FALSE
o1 === o2 : FALSE
o1 !== o2 : TRUE
Jony dos Santos Kostetzer