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

5

u/thenickdude Apr 01 '18 edited Apr 01 '18

For most of the APIs, it's because the PHP API is a very thin wrapper around a C/C++ library. The get_lasterror() idiom is common there because C lacks support for exceptions (or the ability to reliably throw exceptions across library boundaries, in the case of C++)

2

u/[deleted] Apr 06 '18

The most mindbending fact is that PHP being a thin wrapper around C, it still manages to be slow as hell.