22% Faster, A New Era Of Web Development-PHP 7.3 (New Features, Changing Functionalities)

By Mohit Surati Development, PHP June 22, 2019 10 min read 755 Views

Today where technology is the pilot of our digital world, PHP in Web Development is capturing attention for its capability to build dynamic websites. But are you still stuck as why you people are using PHP? Here are a few points that will clarify your doubts:

  • Runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
  • Apache, IIS, Nginx, Lighttpd and many more servers are compatible with PHP
  • Support a wide range of databases
  • Open source language
  • Very simple to learn and runs efficiently on the server side

Fix your gaze on PHP 7.3 that has thumped on our doors recently with advanced features, functionalities, circumventing few features that were with early versions and adept quantum of bug fixes. PHP 7.3 has become the talk of the town for the web developers.

1.   Heredoc and Nowdoc syntax

Observation: Requirements of these syntaxes are more relaxed.

Brushing up the terms:

Heredoc: It starts with <<< followed by a marker and ends with the same tag followed by a semicolon.


print <<<EOT
Welcome to the new version of PHP. Hope you have a world-class experience.

Here EOT is an identifier. In here, the last IDENTIFIER must be the first string in a new line for this to work. Also, there must not be any other characters after the previous IDENTIFIER (other than a semicolon, which is optional).

Nowdoc: You need to enclose the identifier with single quotes. No need to parse anything inside a Nowdoc.


print <<< ‘EOT’
Sea shells she sails on the sea shore.

Valid Syntax in PHP 7.2

class foo{
public $bar = <<< EOT


  • The closing marker may not be indented
  • The line with the closing marker may not contain characters like spaces or tabs
  • The first character before the closing marker must be a newline
  • A new line must follow the closing marker

Allow indenting the closing marker.
You can write the code as:

class foo{
  public $bar = <<< EOT

Note: The closing marker should never be indented further than any other line of the body.

class foo{
public $bar = <<< EOT

The above code will show the Parse Error.

Conclusion: We must use the same indentation characters for the closing marker and any lines of the body.

Termination of heredoc/nowdoc on the same line:

PHP 7.2 Valid Syntax:

$values = [ <<< END
, ‘d e f’];

As per the syntax is given above, a new line must follow the marker to terminate the heredoc/nowdoc.

PHP 7.3 Valid Syntax:

$values = [ <<< END
END, ‘d e f’];

It will be the syntax in PHP 7.3. Here the restriction of ending/terminating heredoc/nowdoc with a new line is removed.

For further details of Heredoc and nowdoc can be referred here:
Heredocs and Nowdocs Syntaxes
Heredoc String
Nowdoc String

2.   Allowing a trailing comma in function calls

PHP 7.2: For group namespaces, you should use trailing commas.

PHP 7.3: For function declaration, you should use trailing commas.

The following examples show where trailing commas are extremely useful:


In early versions, this will throw a PHP Parse error for the trailing ‘,’ after $baz.
PHP Web Development Company can use trailing commas when you’re creating an array with compact(). You should return a formatted string with sprintf(), or when merging an array:

$newArray = array_merge(
        [‘foo’, ‘bar’],

For debugging with trailing commas and how they are robust with isset() and unset():


Conclusion: Only the function calls would be affected. The syntax for function declaration will not change.

For further details visit this link


One of the functionalities that with high regard is looming with PHP 7.3 is the latest technique of handling JSON errors. Though it is not a core feature, it holds the capacity to change the error behavior of json_decode() and json_encode().

Current Situation:

json_decode() returns null on error.
json_encode() returns FALSE on error.

Point to Remember: Both function neither halts execution on an error nor throw any warning.

Proposal for PHP 7.3:
The system introduces a flag. JSON_THROW_ON_ERROR.
Role: On passing this flag, the error behavior of the json_decode() and json_encode() changes.

  • The global error state is left untouched.
  • If an error occurs, these functions throw a JsonException with the message and code set.


  json_decode(“{“, false, 512, JSON_THROW_ON_ERROR);
catch(JsonException $exception){
echo $exception->getMessage(); //echoes “Syntax Error”


  • Parameter parsing errors are not affected by JSON_THROW_ON_ERROR and continue to produce warnings.
  • An invalid dept parameter passed to json_decode() results in a warning and returned a null which is not affected by JSON_THROW_ON_ERROR.

Additional Resources:

JavaScript Object Notation
PHP Language Exceptions

4.  list() Reference Assignment

Reference Assignment: Consider the piece of code given below:
$b = &$a;

As per the above line, $b gets the value of $a but the value is not copied to $b.

Consider the example below:

$a = 3;
$b = &$a; //$b is a reference to $a
print “$an”;  // prints 3
print “$bn”;  // prints 3

Now if we change the value of $a as given below:
$a = 5;
print “$an”;  // prints 5
print “$bn”;  // prints 5 as well as it is referenced to $a

list() construct:
Current Situation: It can be used to assign variables as if they were in an array.
Lacking: Currently not allowed to assign variable values by reference.
PHP 7.3 Proposal: It should allow us to assign variables by reference with a list().
Current Scenario:

$array = [1, 2];
list($a, &$b) = $array;

With PHP 7.3:

$array = [1, 2];
$a = $array[0];
$b = & $array[1];

Advantage: Assigning multiple variables by reference will become possible.

Additional Resources to refer:

To know more about this thing in detail, you can Hire PHP Developer. He/She Will be able to guide this thing with practical examples.

5.   is_countable Function

Current scenario with PHP 7.2:
An error occurs if count() is used to attempt any non-countable thing. Therefore we are forced to write:

if(is_array($foo) || $foo instance of countable){
// $foo is countable

Proposed Plan for PHP 7.3:
The system proposes a function is_countable() which returns true if the given variable is an array or it is is a countable variable is an array, or it is a countable variable, false otherwise. So, you need to modify the code:

// $foo is countable

Additional Links:

6.   array_key_first(), array_key_last()

Current Scenario: You can retrieve the first and the last key of an array by using reset(), end() and key() functions. But the first and the last index can’t be retrieved without changing its inner position. If we go for other options, it will result in a reduction of code reliability and performance.

Proposed Plan for 7.3:
-> array_key_first()
-> array_key_last()
These two functions allow retrieving the first and the last key of a given array without affecting the internal array pointer.

Additional Links:

7.   Argon2 Password Hash Enhancements

Current Scenario in PHP 7.2:
An alternative to Bcrypt algorithm, Argon2 is a hashing algorithm implemented in PHP 7.2. PHP 7.2 introduced the PASSWORD_ARGON2I constant, available to be used in password_* function.
password_hash(‘password’, PASSWORD_ARGON2I);

PHP 7.3:
The system adds a modern alternative of ARGON2: Argon2id

The two early variants were: Argon2d and Argon2i
1. Argon2d – maximizes resistance to GPU cracking attacks.

  • It is faster
  • uses data-depending memory access.

2. Argon2i -uses data-independent memory for password hashing.

  • It makes more passes over the memory to protect from trade-off attacks.

The added one: Argon2id is a hybrid version that combines the Argon2i approach for the first pass over memory, and the Argon2d approach for next passes.

You can implement it:
password_hash(‘password’, PASSWORD_ARGON2ID);

Additional References:

8.   Deprecations

The functions/functionalities removed in PHP 7.3 are:

  • image2wbmp(): This functions outputs or saves a WBMP version of a given image. This function takes three arguments, an image resource, a filename, and a foreground color. For PHP 7.3, when this will be deprecated, it will throw a fatal error.
  • Remove Case_Insensitive Constants: PHP supports both case-sensitive and case-insensitive constants. Observations, class constants, global constants declared with const and constants defined with define() are case-sensitive always. Therefore the following changes are proposed for PHP 7.3 study:

A) Deprecate calling define() with the third parameter set to true – PHP 7.3
B) Deprecate accessing case-insensitive constants with a casing different from a report (except for real, false and null) – PHP 7.3
C) Remove odds to declare case-insensitive constants – PHP 8.0
D) Convert true, false and null from special-cased constants into reserved keywords – PHP 8.0

There are more such proposals for deprecations of functions in PHP 7.3. However, there is no surety for depreciation. Here is the list you can go through to have a brief idea about the deprecations.

Statistics for PHP:
1. 22% faster than earlier versions
2. PHP Version Time-Table
3. PHP statistics for WordPress
4. PHP Statistics for Framework

1. PHP Version 7.3 is quick!

To get a broader aspect of why PHP 7.3 is bringing laurels to the PHP family, we will go through the statistics below:


A benchmark test conducted when PHP 7.3.0 Alpha1 was released. From that survey, researchers find that it was 22% faster than PHP 7.0 and 7% more quickly than the current version of PHP 7.2.

PHP 7.3 has got results using Phoronix’s test suite. Significant improvements in both rendering and data processing tests.


2. Versions:

The table below shows the version to date:


3. PHP statistics for PHP

As per the official website of WordPress, 62.6% of the existing sites are using WordPress 4.9. PHP and MySQL Web Development companies should have an idea of these details.


Read also: Top 8 Benefits of CDN that proves it best for your business


4. PHP for Framework

As per the statistics by w3techs, PHP is used by 83.5% of all websites out of which only 16.3% are using version 7.

The diagram below shows the percentage usage of different versions by the developers:


The all-new PHP 7.3 is all about developers. PHP 7.3 is bringing a lot of new functionalities with it at our doorstep. This article emphasizes all those changes which can be a new phase for every PHP Development Company. If you come across with few more changes, kindly revert in the comment box below and share it here.

Disclaimer: We at eSparkBiz Technologies have created this blog with all the consideration and utmost care. We always strive for excellence in each of our blog posts and for that purpose, we ensure that all the information written in the blog is complete, correct, comprehensible, accurate and up-to-date. However, we can’t always guarantee that the information written in the blog correct, accurate or up-to-date. Therefore, we always advise our valuable readers not to take any kind of decisions based on the information as well as the views shared by our authors. The readers should always conduct an in-depth research before making the final decision. In addition to these, all the logos, 3rd part trademarks and screenshots of websites & mobile apps are the property of the individual owners. We’re not associated with any of them.

Mohit Surati

Mohit Surati

A post-graduate in Computer Engineering. Passionate about innovative writing & Content Marketing. A rich vein of experience in writing articles related to WordPress right from plugins, themes, customization, security, WooCommerce & Gutenberg. Pens down his thoughts for eSparkBiz @Custom WordPress Development Company where you can Hire WordPress Developer as per your requirements.


Follow us

Subscribe Newsletter

Call us Today


Got any Questions?
call us Today!

+1 408 850 1488 [email protected]

Our Guides

Related Post

How To Choose Best Technology Stack for Web Application Development?

How To Choose Best Technology Stack for Web Application Development?

With the world going digital, the amount of businesses opting for web applications has shot up as well. Technology Stack for Web Applications has become…

Top 12 Essential Full Stack Developer Skills To Look Into (Mandatory Skills + Guideline)

Top 12 Essential Full Stack Developer Skills To Look Into (Mandatory Skills + Guideline)

Readers, if you are reading this article, then you are either a young professional looking for a job change, or right out of school and…

Node.js vs PHP: Which one has potential?

Node.js vs PHP: Which one has potential?

Node.js vs PHP are tough competitors of each other in server-side development. One is a runtime environment that builds quick and scalable web-apps, while other…

Share via
Copy link