Stable Release in branch 7.0
7.0.33
Released 10 Jan 2019
(7 years ago)
SoftwarePHP
Version7.0
Status
End of life
Initial release7.0.0
03 Dec 2015
(10 years ago)
Latest release7.0.33
10 Jan 2019
(7 years ago)
End of bug fixes10 Jan 2018
(Ended 8 years ago)
End of security fixes10 Jan 2019
(Ended 7 years ago)
Release noteshttps://www.php.net/ChangeLog-7.php#7.0.33
Source codehttps://github.com/php/php-src/tree/php-7.0.33
Documentationhttps://www.php.net/manual/en/
Downloadhttps://www.php.net/releases/7.0.33
PHP 7.0 ReleasesView full list

What Is New in PHP 7.0

Category Key Changes
Performance PHPNG engine (Zend Engine 3), up to 2x performance improvement
New Features Scalar type declarations, Return type declarations, Spaceship operator, Null coalescing operator
Syntax Anonymous classes, Unicode codepoint escape syntax, Group use declarations
Security Filtered unserialize(), CSPRNG functions, Removal of insecure library dependencies
Deprecated PHP4-style constructors, Multiple default clauses in switch statements
Removed mysql extension, ASP-style tags, ereg extension

What performance improvements does PHP 7.0 offer?

The biggest change is the new PHPNG engine (Zend Engine 3), which delivers significantly reduced memory consumption and up to twice the performance of PHP 5.6. This was achieved through a comprehensive refactoring of internal data structures. In practice, this means your applications run faster and can handle more traffic on the same hardware.

What new language features were introduced?

Scalar and Return Type Declarations

You can now enforce parameter and return value types. This makes code more predictable and self-documenting.

function sum(int $a, int $b): int {
    return $a + $b;
}

Null Coalescing Operator

The ?? operator provides a shortcut for common isset() checks. It returns the first operand if it exists and is not NULL, otherwise the second operand.

$username = $_GET['user'] ?? 'nobody';

Spaceship Operator

The <=> operator is used for combined comparison. It returns -1, 0, or 1 when $a is respectively less than, equal to, or greater than $b.

echo 5 <=> 8; // -1

Anonymous Classes

You can now instantiate objects from unnamed classes, similar to anonymous functions. This is useful for one-off implementations.

$util->setLogger(new class {
    public function log($msg) {
        echo $msg;
    }
});

What security enhancements were made?

The unserialize() function was hardened with an optional whitelist of allowed classes, reducing the risk of object injection attacks. New Cryptographically Secure Pseudo-Random Number Generator (CSPRNG) functions were added: random_bytes() and random_int(). These are the preferred methods for generating secure random values.

What was removed or deprecated?

The old mysql_* functions were completely removed--you must use mysqli or PDO instead. ASP-style tags (<% %>) and script tags (<script language="php">) were also removed. PHP4-style constructors (methods with the same name as the class) are now deprecated and will generate an E_DEPRECATED error.

FAQ

Is PHP 7.0 really twice as fast?
Yes, for many real-world applications, especially those using popular frameworks, the performance improvement is very noticeable. The reduced memory footprint is often just as beneficial.

Why should I use the new null coalescing operator?
It dramatically cleans up verbose isset() checks. Instead of writing $a = isset($b) ? $b : $c;, you can simply write $a = $b ?? $c;.

My code uses the old mysql extension. What do I do?
You must migrate to either MySQLi or PDO_MySQL before upgrading. This is a breaking change and the most common upgrade hurdle from PHP 5.x.

What are the new CSPRNG functions for?
Use random_int() for generating cryptographically secure integers and random_bytes() for generating secure random strings. They replace older functions like rand() and openssl_random_pseudo_bytes() for security-critical tasks.

Are typed returns enforced strictly?
It depends on the declared strict mode. By default, PHP will attempt to coerce types. You can enable strict mode by declaring declare(strict_types=1); at the top of your file, which will cause type mismatches to throw a TypeError.

Releases In Branch 7.0

VersionRelease date
7.0.3310 Jan 2019
(7 years ago)
7.0.3213 Sep 2018
(7 years ago)
7.0.3119 Jul 2018
(8 years ago)
7.0.3026 Apr 2018
(8 years ago)
7.0.2929 Mar 2018
(8 years ago)
7.0.2801 Mar 2018
(8 years ago)
7.0.2704 Jan 2018
(8 years ago)
7.0.2623 Nov 2017
(8 years ago)
7.0.2526 Oct 2017
(8 years ago)
7.0.2428 Sep 2017
(8 years ago)
7.0.2331 Aug 2017
(8 years ago)
7.0.2203 Aug 2017
(9 years ago)
7.0.2106 Jul 2017
(9 years ago)
7.0.2008 Jun 2017
(9 years ago)
7.0.1911 May 2017
(9 years ago)
7.0.1813 Apr 2017
(9 years ago)
7.0.1730 Mar 2017
(9 years ago)
7.0.1616 Feb 2017
(9 years ago)
7.0.1519 Jan 2017
(9 years ago)
7.0.1408 Dec 2016
(9 years ago)
7.0.1310 Nov 2016
(9 years ago)
7.0.1213 Oct 2016
(9 years ago)
7.0.1115 Sep 2016
(9 years ago)
7.0.1018 Aug 2016
(9 years ago)
7.0.921 Jul 2016
(10 years ago)
7.0.823 Jun 2016
(10 years ago)
7.0.726 May 2016
(10 years ago)
7.0.628 Apr 2016
(10 years ago)
7.0.531 Mar 2016
(10 years ago)
7.0.403 Mar 2016
(10 years ago)
7.0.304 Feb 2016
(10 years ago)
7.0.207 Jan 2016
(10 years ago)
7.0.117 Dec 2015
(10 years ago)
7.0.003 Dec 2015
(10 years ago)