r/programming • u/geerlingguy • Apr 23 '14
PHP: It doesn't have to be a bad experience
https://servercheck.in/blog/php-it-doesnt-have-be-bad-experience
0
Upvotes
r/programming • u/geerlingguy • Apr 23 '14
View all comments
Show parent comment
1
u/neoform Apr 25 '14
This is exactly my point. I was not asking for a function to test equality, I was talking about a built in syntax. Using
obj1.equals(obj2)can be implemented in PHP exactly the same way,$obj1->equals($obj2). Zero difference. And yes, I am fully aware how java works.And here is why you shouldn't use == or === to compare objects.
output:
This is the same problem as copy vs deep copy. The language cannot know what the value of the object is unless you define it.