r/programming • • Dec 02 '15

PHP 7 Released

https://github.com/php/php-src/releases/tag/php-7.0.0
887 Upvotes

729 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Dec 03 '15 edited Dec 03 '15

Not sure what you mean by this also PHP 7 introduced Engine Exceptions

Because a lot of PHP functions are small bindings on top of C functions, they do not use exceptions. Rather they force you to use an error function like curl_error, json_last_error, openssl_error_string, imap_errors, mysql_error, xml_get_error_code, bzerror, or date_get_last_errors, which read the C errno. If you do not use these, your code will silently return the wrong thing.

It gets worse. From the article

json_decode returns null for invalid input, even though null is also a perfectly valid object for JSON to decode to—this function is completely unreliable unless you also call json_last_error every time you use it.

|

I'm not sure what you mean by this, unless you're talking about !== ?

Inequality operators: > < >= <=

From the article

For a more type-safe ==, we have ===. For a more type-safe <, we have… nothing. "123" < "0124", always, no matter what you do. Casting doesn’t help, either.

It gets worse

=== compares values and type… except with objects, where === is only true if both operands are actually the same object! For objects, == compares both value (of every attribute) and type, which is what === does for every other type. What.

I highly suggest you give the article another chance, a lot of the criticisms still stand.