What’s New in PHP 7.3?

  • Feb 08, 2019
  • 0
  • by Brad Litwin

The release of PHP 7.0 bought with it numerous features, vastly improving the performance and security of PHP applications. Since they’re known for frequent updates, however, it comes as no surprise that the core PHP maintenance team had even more up their sleeves.

December 6th, 2018 saw the launch of PHP 7.3 – the most recent update for this key scripting language. The update brings a host of new features and functionality to the table, including bug fixes and another boost in performance speed.

In this post, we’ll explore some of the exciting new elements included in PHP 7.3. Let’s get started!

A Brief Introduction to PHP (And Why It Matters)

PHP is a widely-used, open-source, and general-purpose scripting language that is especially well suited for web development. PHP can be easily embedded into HTML, meaning that it is both accessible and flexible.

This scripting language was first developed in 1994 by Rasmus Lerdorf. He created the language entirely for personal use, hence the original name: “Personal Home Page Tools”. Despite its humble beginnings, PHP is now one of the most commonly-used server side programming languages in the world.

That’s because PHP is generally considered simple enough for beginners to understand, yet it offers advanced features that more experienced developers can take advantage of. Regardless of your level of expertise, having a basic understanding of PHP is handy if you’re in the business of running or building websites.

PHP is compatible with all major Operating Systems (OSs), and can also be used with popular database tools like MySQL. It’s often used to create dynamic content, such as PDFs, images, and videos. What’s more, it’s always being updated, in order to provide new features and improve performance.

3 Key Changes Introduced in PHP 7.3

PHP 7.3 is the most recent in a long line of updates to this scripting language, as the developers are constantly making changes and improvements. The latest version of PHP brings a number of exciting changes to the table – let’s explore three of the most prominent.

1. Flexible Heredoc and Nowdoc Syntaxes

Perhaps one of the most relevant improvements PHP 7.3 brings is an update to the existing heredoc and nowdoc syntaxes. These are two key methods for defining strings within PHP.

Traditionally, these syntaxes have required that the ending identifier should be the first string appearing in a new line. The update within PHP 7.3 brings two changes: it enables the closing marker for indenting, and removes the new line requirement after the closing marker. This is especially useful when using Heredoc in an already-nested context.

Heredoc and nowdoc syntaxes have very rigid requirements that have often caused them to be ignored by developers. Their usage in code can look ‘ugly’, and harm readability. The 7.3 update brings an improved look and boosted readability to these key syntaxes.

2. A Boost in Performance Speed

When PHP 7.0 was released, it claimed to be twice as fast as PHP 5.6. Now, PHP 7.3 is 31% faster than PHP 7.0 – meaning that it smashes the previous benchmark out of the water.

It’s also just shy of being 10% faster than PHP 7.2, meaning that this update brings dramatically-improved performance speed no matter what previous version you were using. This is important, since performance plays a huge role in creating a positive user experience. Just to give one example, when Mozilla shaved 2.2 seconds off its landing page’s loading time, Firefox downloads increased by 15.4%.

Slow-loading pages can mean loosing out on potential customers, as they’ll often move on to a faster service. Fortunately, the new boost to PHP should benefit sites that rely on this scripting language. Plus, a faster programming speed also means that developers are able to work more efficiently.

3. Allowance for a Trailing Comma in Function Calls

Trailing commas are commas added to a list of elements, parameters, or properties. They can come in handy, as they allow for cleaner code that is simpler to understand and edit.

PHP already permitted trailing commas in arrays. Now, the 7.2 update brings the addition of commas in grouped namespaces. PHP 7.3 enables developers to add trailing commas in function declarations. However, it’s important to note that this change will affect function calls only – function declaration syntax isn’t going to change.

While these are some of the most prominent changes PHP 7.3 brings, they’re just the tip of the iceberg. The update also includes Argon2 password hash enhancements, and a few new functions. You can check out the PHP website for a more extensive list of features.

Conclusion

As one of the most popular open-source scripting languages, PHP is known for its frequent updates and improvements in user experience. The latest release, PHP 7.3, is no different – bringing with it plenty of new and improved functionality.

In this post, we explored a few of the new features this PHP update includes. These are:

  • Further improvements to the existing heredoc and nowdoc syntaxes.
  • An increase in overall performance speed.
  • The ability to add a trailing comma in function calls.

Do you have any more questions about the PHP 7.3 release? Let us know in the comments section below!

Image credit: Pixabay.

The A2 Posting

  • Popular
  • Recent
  • Categories
  • Tags