The introduction of PHP 7.3 marks some notable improvements as we see 7 going through some stages of maturation. There are also several backward incompatible changes that should be noted as they will break functionality or cripple entire sites that implement it haphazardly.

Compatibility Breaking Changes

BCMath

Some notable changes have been made here regarding the error handling. Previously errors thrown by BCMath were written directly to stderr but now use PHP’s native error handling.

bcmul() and bcpow() now return numbers with the requested scale. Previously numbers left out trailing decimal zeroes which caused issues for many people.

SimpleXML

Here’s a positive change. All mathematical operations involving SimpleXML objects will now be treated as an integer or a float. This marks a big change from the previous handling of treating everything as integers.

getimagesize()

Some smaller notable changes here with getimagesize() that return the mime type of the bitmap images as image/bmp instead of image/x-s-ms-bmp. This is due to a change with IANA (see RFC 7903).

New Features

Flexible Heredoc and Nowdoc Syntax

Some changes have been made that will improve the usability of the heredoc and nowdoc synax. Notable improvements are closing markers do not require a semicolon or newline. Also the closing marker may be indented which will cause all the indentation to be stripped from all lines in the doc string.

JSON_THROW_ON_ERROR

There’s been a problem for quite some time which has involved inadequate ways to handle errors whilst using JSON. It’s really been a major drag for all developers using PHP.

Due to an overwhelming demand from users we’re now seeing a dramatic improvement in the usability. JSON_THROW_ON_ERROR will now catch the error and display it using the following exception methods:

$e->getMessage(); // like json_last_error_msg()$e->getCode(); // like json_last_error()

Conclusion

I’m pretty pleased overall with the scope of new changes introduced. Most of the backwards incompatible changes are relatively minor and the performance improvements we’re seeing are notable. From PHP 7.0 we are seeing a significant increase of speed up to 31%. That should allow developers to run existing websites with a tad less resources then normally accustomed to. We’re all big fans of value and efficiency so the big winner here might just be the overall performance.

PHP Performance Benchmarks
PHP Performance Benchmarks
Categories: PHP News

Sainsbury Development Limited