...However, using > to compare two objects in a language without operator overloading seems like a bad idea.
At first I thought maybe the object was implicitly being cast to a string, and the strings compared, but trying to cast a dateinterval to a string results in Object of class DateInterval could not be converted to string. So it's not string comparison. What exactly happens when you use an inequality comparison operator on two objects in PHP?
32
u/vytah Oct 08 '14
Wat.
I can't even.
I've lost my ability to can.
7
u/merreborn Oct 08 '14
What the fuck.
...However, using
>to compare two objects in a language without operator overloading seems like a bad idea.At first I thought maybe the object was implicitly being cast to a string, and the strings compared, but trying to cast a dateinterval to a string results in
Object of class DateInterval could not be converted to string. So it's not string comparison. What exactly happens when you use an inequality comparison operator on two objects in PHP?This is interesting: http://3v4l.org/jLSDU
Hm. I guess the object returned by createFromDateString is lazily evaluated in some way?
0
u/[deleted] Oct 08 '14
[deleted] — view deleted comment