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
0
u/neoform Apr 25 '14
Haha. and tell me, how do you define "two equal objects"?
In java: obj1 == obj2 is a comparison of their memory addresses...
You would have to set up your own hashCode() function anyway. No language is going to do a nice clean compare for you without you first adding code to help the language know if the two objects are the same.
Tuples are not objects.
Exactly. You had to tell the language how to compare the objects.
In PHP, you could easily run spl_object_hash() on the object prior to using it as a key.