To put this in context, in many OO languages objects are compared by their identity. In pseudo code:
bar = new Foo
baz = new Foo
bar == baz // false
Although both objects are basically the same, if you just look at their meanings, they are not considered identical because they are separate instances. To demonstrate:
bar = new Foo
baz = bar
bar == baz // true
Now:
, , .
http://en.wikipedia.org/wiki/Value_object
" ":
address1 = new Address('Main street 42')
address2 = new Address('Main street 42')
address1 == address2 // true
, , .
PHP " ", . :
(==) , : , .
http://www.php.net/manual/en/language.oop5.object-comparison.php
:.
$address1 = new Address('Main street 42');
$address2 = new Address('Main street 42');
$address1 == $address2;
$address1 === $address2;