The Best New PHP 7.3 Features You Should Know About

PHP 7.0 was loaded with several exciting new features, greatly improving PHP applications’ security and speed. The same is the case with PHP 7.3; released in Dec ’18, the most recent update to the widely-used server-side programming language brings with it a handful of new features and functionality, including bug fixes and modest speed improvements.

In this post, we’ll explore some of the exciting new elements included in the newest update. Let’s begin!

A Brief Overview of PHP

Before we get down to its features, let us first briefly overview this scripting language.

First created in ’94 by Rasmus Lerdorf, PHP is a popular, open-source, and general-purpose programming language that is especially well suited for web development.

Lerdorf developed the scripting language entirely for personal use; today, it is one of the most widely-used server-side programming languages globally.

The reason behind its popularity is that it caters to the needs of both beginners and experienced developers by being simple enough to learn and offering advanced features. It’s necessary to have a basic understanding of this scripting language if you’re in the business of running or building websites.

Compatible with all major OSs, PHP can also be used with popular database tools like MySQL. It’s often used to create dynamic content, such as images, PDFs, and videos. Another thing, it’s always being updated, to provide new features and improved performance.

1. Flexible Heredoc and Now doc Syntaxes

I think this is one of the best improvements that PHP 7.3 brings to the table. Heredoc and Now doc Syntaxes are the two key methods for defining strings within this key scripting language. Previously, they required that the ending identifier should be the first string appearing in a new line. The new update brings with it two changes:

  • now, you can indent the closing marker
  • and are no longer required to begin a new line after the closing marker

These changes will surely result in a more attractive and elegant looking code and boost readability, which was not the case previously.

2. Allowance for a Trailing Comma in Function Calls

Added to a list of parameters, properties, or elements, trailing commas helps make the code more clean and readable.

This update enables us to use the trail commas (which we can already use in arrays and grouped namespaces, thanks to the 7.2 update) in function declarations. However, it’s important to note that this update will not result in any change in function declaration syntax and affect function calls only.


A huge PHP drawback has finally been fixed with this update. Previously, there were no adequate methods to handle JSON errors; Json_encode () will throw only false errors, whereas Json_decode will throw null, and null can be the true value. The only possible way for developers to handle the errors was by calling json_last_error () or json_last_error_msg ().

With PHP 7.3, you can easily handle this issue by adding JSON_THROW_ON_ERROR in json_encode () and json_decode (), which will completely ignore the global error state.

4. list () Reference Assignment

We already had a list () and reference assignment methods in PHP. But later updates did not permit using reference assignment in a list (), which has changed now as the new version allows you to use it with proper syntax.

5. is_countable Function

Previously, the count () function was used by developers to count arrays and objects, but the issue was that developers could not count or try a loop on uncountable objects. It would throw a warning message, and then we had to check whether the variable or object was counted or not. PHP 7.3 has introduced a new method called is_countable, which will return the passed variable only when it’s countable.

6. array_key_first (), array_key_last ()

In the older version, you could get the first value or array last key just by changing the current state of the array using various methods such as end(), key(), and so forth. While the new version has introduced new functions to perform these duties,

$value = array_value_last ($array); to get last value of array

$key = array_key_last ($array); to get last key of array

Replace ‘last’ with ‘first’ to get the first key and valve of the array.

7. Argon2 Password Hash Enhancements

PHP 7.3 gives you several password hashing mechanisms, unlike its predecessor, which used Argon2 Password hashing only. Following are the different mechanisms it uses:

  • Argon2i
  • Argon2d
  • Argon 2id

8. A Boost in Performance Speed

When the 7.0 version was launched, it claimed to be twice as fast as the 5.6 one. This new version is thirty-one percent faster than the 7.0 one– meaning that it smashes the previous benchmark out of the park.

It’s also just shy of being ten percent faster than the 7.2 one, meaning that this new version brings dramatically-improved performance speed to the table no matter what the previous version you were using. I’m mentioning this because performance plays a huge role in creating a positive user experience.

Slow-loading pages can easily translate into losing out on potential customers, as they’ll often move on to a faster service. Fortunately, the new boost should benefit sites that rely on PHP. Plus, a faster programming speed also means that developers can work more efficiently.

9. Deprecations

Following are the deprecated features:

Case-Insensitive Constants:

To make things simpler, PHP 7.3 no more supports the Case-insensitive constants. They were subjected to inconsistencies and were difficult to use.

image2wbmp ():

You will get a deprecation warning if you use image2wbmp () any more in the code. This method generated a WBMP image format, which is no more in use now.


Trying to keep up with the ongoing trends of other programming languages, PHP is taking one step forward at a time. So far, we have been through all the important new updates & features of PHP 7.3, and I hope it helps you. Enjoy the new PHP coding, folks!

Leave a Comment

The reCAPTCHA verification period has expired. Please reload the page.