Latest in branch 7.3
7.3.33
Released 18 Nov 2021
(4 years ago)
SoftwarePHP
Version7.3
Status
End of life
Initial release7.3.0
06 Dec 2018
(7 years ago)
Latest release7.3.33
18 Nov 2021
(4 years ago)
End of bug fixes06 Dec 2020
(Ended 5 years ago)
End of security fixes06 Dec 2021
(Ended 4 years ago)
Release noteshttps://www.php.net/ChangeLog-7.php#7.3.33
Source codehttps://github.com/php/php-src/tree/php-7.3.33
Documentationhttps://www.php.net/manual/en/
Downloadhttps://www.php.net/releases/7.3.33
PHP 7.3 ReleasesView full list

What Is New in PHP 7.3

PHP 7.3 delivers incremental improvements focused on developer convenience, modern syntax, and tighter security. It's a refinement release that makes everyday coding a bit smoother without major breaking changes.

Category Key Changes
New Features Flexible Heredoc/Nowdoc, Trailing Commas, list() Reference Assignment, is_countable(), array_key_first(), array_key_last()
Deprecations Case-Insensitive Constants, Undocumented MBString Regex, FILTER_FLAG_SCHEME_REQUIRED, image2wbmp()
Security PCRE2 Upgrade, Multiple Encryption Fixes
Other Changes JSON Error Handling, LDAP Controls Support

What are the new syntax features in PHP 7.3?

This release introduces several syntax tweaks that clean up code. The most noticeable is flexible Heredoc and Nowdoc syntax, which no longer requires the closing tag to be on a line by itself.

Trailing commas in function calls are now allowed. This is great for version control diffs because adding a new parameter doesn't change the previous line. You can also assign references directly from list() or [].

// Flexible Heredoc
$text = <<<END
  a
  b
  c
  END;

// Trailing comma
$array = [1, 2, 3,];

// list() reference assignment
list($a, &$b) = $array;

Which new array functions were added?

PHP 7.3 adds three utility functions for common array operations. array_key_first() and array_key_last() fetch the first and last keys of an array without resetting the internal pointer.

The is_countable() function solves a common warning. It checks if a variable is an array or implements Countable, preventing the "count(): Parameter must be an array or an object that implements Countable" error.

$array = ['a' => 1, 'b' => 2, 'c' => 3];

$firstKey = array_key_first($array); // 'a'
$lastKey = array_key_last($array);  // 'c'

if (is_countable($maybeArray)) {
    $count = count($maybeArray);
}

What has been deprecated?

Several outdated behaviors are now soft-deprecated, meaning they generate warnings. Defining case-insensitive constants is deprecated; all constants are case-sensitive.

Using undocumented regex styles in the Mbstring extension triggers a warning. The FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED flags for filter_var() are also deprecated. The function image2wbmp() is replaced by imagewbmp().

// Deprecated: Case-insensitive constant
define('CONSTANT', 1, true);

// Deprecated: Undocumented mbstring regex
mb_ereg_match('(?xyz)[a-z]*', 'abc');

How did JSON handling improve?

JSON error handling got a significant upgrade. The new JSON_THROW_ON_ERROR option for json_encode() and json_decode() makes error handling much cleaner.

Instead of checking the return value for null and then calling json_last_error(), you can wrap your calls in a try/catch block. This brings JSON parsing in line with modern exception-based practices.

try {
    $data = json_decode($json, true, 512, JSON_THROW_ON_ERROR);
} catch (JsonException $e) {
    echo $e->getMessage();
}

What are the security updates?

The underlying PCRE library was upgraded to PCRE2, which provides better security and support for modern regex standards. This change is mostly internal but ensures the engine remains robust.

Multiple fixes were applied to the OpenSSL and Cryptography extensions. These patches address edge cases and potential vulnerabilities in encryption handling, making the crypto functions more reliable.

FAQ

Should I upgrade my production application to PHP 7.3 immediately?
Yes, but test first. PHP 7.3 is a minor release with mostly additive changes and deprecation warnings. The upgrade path from 7.2 is generally smooth, but you should check for any deprecated features you might be using.

What is the most useful new feature for everyday coding?
Trailing commas in function calls are a small but impactful quality-of-life improvement. It makes editing multi-line arrays and function arguments cleaner in version control systems like Git.

I keep getting a warning about case-insensitive constants. How do I fix it?
This means you're using the third parameter in a define() call and setting it to true. Remove that parameter and ensure your code uses the correct case for the constant name, as all constants are now strictly case-sensitive.

Does the new JSON exception handling break existing code?
No, it's entirely optional. Your old code that uses json_last_error() will continue to work exactly as before. The new JSON_THROW_ON_ERROR flag is an alternative, better way to handle errors.

Why was the PCRE library upgrade to PCRE2 important?
PCRE2 is the modern, maintained version of the Perl Compatible Regular Expressions library. The upgrade provides security patches, bug fixes, and support for newer regex syntax that wasn't available in the older PCRE library.

Releases In Branch 7.3

VersionRelease date
7.3.3318 Nov 2021
(4 years ago)
7.3.3228 Oct 2021
(4 years ago)
7.3.3123 Sep 2021
(4 years ago)
7.3.3026 Aug 2021
(4 years ago)
7.3.2901 Jul 2021
(4 years ago)
7.3.2829 Apr 2021
(5 years ago)
7.3.2704 Feb 2021
(5 years ago)
7.3.2607 Jan 2021
(5 years ago)
7.3.2526 Nov 2020
(5 years ago)
7.3.2429 Oct 2020
(5 years ago)
7.3.2301 Oct 2020
(5 years ago)
7.3.2203 Sep 2020
(5 years ago)
7.3.2106 Aug 2020
(5 years ago)
7.3.2009 Jul 2020
(5 years ago)
7.3.1911 Jun 2020
(6 years ago)
7.3.1814 May 2020
(6 years ago)
7.3.1716 Apr 2020
(6 years ago)
7.3.1619 Mar 2020
(6 years ago)
7.3.1520 Feb 2020
(6 years ago)
7.3.1423 Jan 2020
(6 years ago)
7.3.1318 Dec 2019
(6 years ago)
7.3.1221 Nov 2019
(6 years ago)
7.3.1124 Oct 2019
(6 years ago)
7.3.1026 Sep 2019
(6 years ago)
7.3.929 Aug 2019
(6 years ago)
7.3.801 Aug 2019
(6 years ago)
7.3.704 Jul 2019
(6 years ago)
7.3.630 May 2019
(7 years ago)
7.3.502 May 2019
(7 years ago)
7.3.404 Apr 2019
(7 years ago)
7.3.307 Mar 2019
(7 years ago)
7.3.207 Feb 2019
(7 years ago)
7.3.110 Jan 2019
(7 years ago)
7.3.006 Dec 2018
(7 years ago)