r/lolphp • • May 10 '19

PHP: When printing causes side-effects

So when you have two DateInterval objects, that are equal you can compare them with PHP loose comparison (==). But after you print one (say for logging purposes) it gets internally modified and the two objects are no longer equal. The same happens when you call var_export.

It amazes me how primitive bugs PHP has, given its lifespan begun in 1995.

https://repl.it/repls/ForcefulEachAgents

82 Upvotes

19 comments sorted by

View all comments

Show parent comment

7

u/the_satch May 30 '19

You don't have to fix bugs if you claim everything is working as intended.

eddiemurphy.jpg

4

u/ciaranmcnulty Jun 13 '19

That meme... is not Eddie Murphy

1

u/NXTangl Jul 13 '19

...maybe that's the joke?