note 69214 added to language.oop5.object-comparison
| From: | jonyATjonyskDOTnet at osu1 dot php dot net | Date: | Sun, 27 Aug 2006 18:23:25 +0000 |
| Subject: | note 69214 added to language.oop5.object-comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116387@lists.php.net to get a copy of this message | ||
"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
----
Server IP: 66.163.161.117
Probable Submitter: 201.25.245.240
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.oop5.object-comparison.php
Edit -- https://master.php.net/note/edit/69214
Del: integrated -- https://master.php.net/note/delete/69214/integrated
Del: useless -- https://master.php.net/note/delete/69214/useless
Del: bad code -- https://master.php.net/note/delete/69214/bad+code
Del: spam -- https://master.php.net/note/delete/69214/spam
Del: non-english -- https://master.php.net/note/delete/69214/non-english
Del: in docs -- https://master.php.net/note/delete/69214/in+docs
Del: other reasons-- https://master.php.net/note/delete/69214
Reject -- https://master.php.net/note/reject/69214
Search -- https://master.php.net/manage/user-notes.php