|
|||||||||
|
|||||||||
Comparing objectsIn PHP 4, objects are compared in a very simple manner, namely: Two object instances are equal if they have the same attributes and values, and are instances of the same class. Similar rules are applied when comparing two objects using the identity operator (===). If we were to execute the code in the example below: Пример #1 Example of object comparison in PHP 4
<?phpРезультат выполнения данного примера:
Even in the cases where we have object composition, the same comparison rules apply. In the example below we create a container class that stores an associative array of Flag objects. Пример #2 Compound object comparisons in PHP 4
<?phpРезультат выполнения данного примера:
| |||||||||
|
|||||||||