June 2017
Intermediate to advanced
536 pages
9h 49m
English
The PHP language provides several comparison operators that allow us to compare two different values, resulting in either true or false:
While all of these operators are equally important, let's take a closer look at the behavior of the equal (==) and identical (===) operators in the context of objects.
Let's take a look at the following example:
<?phpclass User { public $name = 'N/A'; public $age = 0;}$user = new User();$employee = new User();var_dump($user == $employee); // truevar_dump($user === $employee); // false
Here, we have a simple User class with two properties ...
Read now
Unlock full access