Quick Inquiry

22% Faster, A new era of web development- PHP 7.3(New Features, Changing Functionalities)

22% Faster, A new era of web development- PHP 7.3(New Features, Changing Functionalities)

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

  1. Runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
  2. Apache, IIS, Nginx, Lighttpd and many more servers are compatible with PHP
  3. Support a wide range of databases
  1. Open source language
  2. 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 marker 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. In addition, there must not be any other characters after the last IDENTIFIER (other than a semi colon, which is optional).

Nowdoc: The identifier is enclosed with single quotes. No parsing is done 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
  • The closing marker must be followed by a newline

Allow indenting the closing marker.
The code can be safely written 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 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 in order to terminate the heredoc/nowdoc.

PHP 7.3 Valid Syntax:

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

This 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: Trailing commas are used in group namespaces.
PHP 7.3: Trailing commas will be used in function declarations.

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.
A trailing comma can be used when an array with compact() is created. This is done in order to 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 powerful 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 are held in 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 behaviour 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:
A flag is introduced. JSON_THROW_ON_ERROR.
Role: On passing this flag, the error behavior of the json_decode() and json_encode() changes.

  1. Global error state is left untouched.
  2. 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”


  1. Parameter parsing errors are not affected by JSON_THROW_ON_ERROR and continue to produce warnings.
  2. An invalid dept parameter passed to json_decode() results in a warning and returns 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 “$a\n”;  // prints 3
print “$b\n”;  // prints 3

Now if we change the value of $a as given below:
$a = 5;
print “$a\n”;  // prints 5
print “$b\n”;  // 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:

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:
A function is_countable() is proposed 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, the code above is modified as:

// $foo is countable

Additional Links:

6.   array_key_first(), array_key_last()

Current Scenario: The first and the last key of an array can be retrieved by using reset(), end() and key() functions. But the first and the last index can’t be retrieved without changing its internal state. If we go for other options, it would 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:
A new variant of ARGON2 has been added: 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 access preferred for password hashing.

  • It is slower as 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 subsequent passes.

It is proposed to be implemented as follows:
password_hash(‘password’, PASSWORD_ARGON2ID);

Additional References:

8.   Deprecations

The functions/functionalities removed in PHP 7.3 are as follows:

  1. image2wbmp(): This functions outputs or saves a WBMP version of a given image. This function takes 3 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.
  2. Remove Case_Insensitive Constants: PHP currently supports both case-sensitive and case-insensitive constants. But as per 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 as per 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 the declaration (with the exception of true, false and null) – PHP 7.3
C) Remove the possibility 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. But not sure whether they are depreciated or not. 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 really fast!

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 was conducted when PHP 7.3.0 Alpha1 was released. It was found that it was 22% faster than PHP 7.0 and 7% faster than the current version of PHP 7.2.

PHP 7.3 also performed well when using Phoronix’s own test suite. Significant improvements in both rendering and data processing tests.

2. Versions:

The table below shows the version that is released till date:

3. PHP statistics for PHP

As per the official website of WordPress, the version of WordPress being used currently is 4.9 and used by 62.6%:

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 version 7 is used by 16.3%.

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


The all new PHP 7.3 is all about the web 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 each and every PHP Development Company. If you come across with few more changes, kindly revert back 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 Technologies – A Custom WordPress Development Company where you can Hire WordPress Developer as per your requirements.

Have an App Idea?

Get your free consultation now

Get Your Free 20-Minute Website Discovery Consultation

To explore how we can help you create a sales weapon that’ll capture and convert more customers, fill out your details below and we’ll be in touch within the next two hours.