New features in PHP 7.3

Prime Numbers

Deprecation by Installments

Finally, some features, functions, and syntax elements have been marked as deprecated. For example, PHP programmers should no longer declare constants that are case insensitive: PI and Pi are different constants in PHP 7.3. If you pass in TRUE as the third parameter in define(), and thus try to create a case-insensitive constant, you will now see a warning.

PHP provides several functions that search for a string in text and accept the text to be searched for in a parameter referred to as a "needle." From now on, the needle must consist of a string. The PHP authors recommend casting the needle into a string if in doubt or explicitly using the chr() function. Other functions affected by this change are strpos(), strrpos(), stripos(), strripos(), strstr(), strchr(), strrchr(), and stristr().

As of PHP 7.3, developers can no longer declare assert() within a namespace. The fgetss() and gzgetss() functions, the SplFileObject::fgetss() method, and the string.strip_tags stream filter are also considered obsolete. In the future, PHP programmers will also have to do without the FILTER _FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED constants. However, both are included in FILTER_VALIDATE_URL, which is still available.

The PHP team sorted out image2wbmp() and all the undocumented functions that start with mbereg_. Instead of the latter, PHP programmers should now use the mb_ereg_ functions. When accessing ODBC and DB2 databases via the PDO_ODBC driver, the pdo_odbc.db2_instance_name setting is history.

Expired

Support for PHP 5.6 and 7.0 was discontinued at the end of 2018, so the developers will no longer be fixing vulnerabilities in these versions. Various statistics show, however, that the old versions are still used on many websites. At the beginning of 2019, almost two thirds of all Joomla installations still ran PHP version 5.6 or earlier [2] (Figure 1) – a rough estimate, because not all Joomla site operators send their data to the developers.

Figure 1: PHP version legend clockwise from the orange section: versions 5.3-5.6 and 7.0-7.2.

Metasploit provider Rapid7 reports similarly worrying figures. As part of the Sonar project, Rapid7 regularly scans the Internet and collects information about the software in use. In December 2018, the statistics showed around 3 million sites with an outdated PHP version [3].

If you still have an older version, you should switch to the current PHP, if possible, because the days of PHP 7.1 are numbered. The developers are currently only providing security updates for this version, but this support will be terminated December 1, 2019 (Figure 2). The PHP team has actively supported only PHP 7.2 and 7.3 since January 1, 2019, with the first of these receiving only one year of security patches as of November 30, 2019 [4].

Figure 2: According to the timeline on the PHP website, the service life of PHP 5.5, 5.6, and 7.0 has already expired.

Conclusions

If you're starting a new PHP project, your best choice is version 7.3, which has some useful new features. Although manageable, the new kids on the block can disrupt existing software. Site operators and web developers are therefore well advised to adapt existing scripts, especially if PHP 5.6 or 7.0 is still in use. The PHP team has published a migration guide for programmers on its website that explains the differences between versions 7.2 and 7.3 [5].

Infos

  1. PHP 7.3 announcement: http://php.net/archive/2018.php#id2018-12-06-1
  2. Joomla statistics: https://developer.joomla.org/about/stats.html
  3. "Charting the forthcoming PHPocalypse in 2019" by Bob Rudis. Rapid7 blog, December 17, 2018: https://blog.rapid7.com/2018/12/17/charting-the-forthcoming-phpocalypse-in-2019/
  4. PHP version support: https://secure.php.net/supported-versions.php
  5. Migrating from PHP 7.2 to 7.3: http://php.net/manual/en/migration73.php

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Lua for Apache

    Lua is a small, lean, and fast scripting language – ideal for working with web servers. Version 2.4 of the Apache web server is the first to offer a matching module that has a few quirks – and pitfalls, if you dig more deeply.

  • Program from one source to many apps with Flutter
    Developing apps in the past for Android, iOS, the web browser, and the desktop meant having to write different versions of the code; however, that's no longer the case thanks to Google's Flutter framework.
  • Innovations in PowerShell 5
    Windows 10 brings an updated, fifth release of PowerShell that vastly simplifies the task of managing modules and software packages. The scripting language now also handles various formatted output from commands and selection lists.
  • The Lua scripting language
    The Lua scripting language is built in to a variety of programs. In this article, we provide an insight into the Lua cosmos.
  • The Lua Scripting Language

    Is this powerful but simple scripting language big enough for Big Data?

comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs



Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>
	</a>

<hr>		    
			</div>
		    		</div>

		<div class=