Skip to content

Commit

Permalink
Fixed wrong answer on object instances comparison
Browse files Browse the repository at this point in the history
`instanceof` only checks the class of a variable. It doesn't allow object comparison.
`===` must be used here (`==` is not sufficient as it doesn't check the type).
  • Loading branch information
lolautruche committed May 9, 2016
1 parent 603e87e commit f4f3b41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions data/questions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ questions:
answers:
- {value: 'if($obj1->equals($obj2) && ($obj1 instanceof $obj2))', correct: false}
- {value: 'if($obj1->equals($obj2))', correct: false}
- {value: 'if($obj1 instanceof $obj2)', correct: true}
- {value: 'if($obj1 == $obj2)', correct: false}
- {value: 'if($obj1 instanceof $obj2)', correct: false}
- {value: 'if($obj1 === $obj2)', correct: true}
-
question: 'In PHP 5 you can use the ______ operator to ensure that an object is of a particular type. You can also use _______ in the function declaration.'
answers:
Expand Down

0 comments on commit f4f3b41

Please sign in to comment.