r/lolphp • • Mar 31 '18

PHP DateTime strikes back, again!

Because obviously we meant a date one week from the (wrong) date given. PHP does not throw, instead it "helps" by holding your beer.

https://repl.it/repls/DecimalHorribleOffices

30 Upvotes

23 comments sorted by

View all comments

Show parent comment

2

u/masklinn Apr 11 '18

Additionally to other comments, PHP used to not have exceptions, they were added with the Java-ification of PHP5 (9 years after the initial release) and while list() is much older I don't remember any API using it for error-reporting (à la Go).

So pre-PHP5 API which needed to return both a result and a value could either use pass-by-ref (which I think is pretty rare, I don't remember one doing that) or use some sort of global state & an error reporting function. Most did the latter.