1. Home
  2. PHP EOL Dates
  3. PHP 7.4

PHP 7.4 End of Life

PHP 7.4 has been end of life since November 28, 2022, and it is still one of the most used PHP versions. Here is why that is a problem and how to make the jump to PHP 8.

End of life
Ended 1,428 days ago

Security support ended on Nov 28, 2022

19.6%

of PHP websites run 7.4
(W3Techs, Oct 26, 2026)

ReleasedNov 28, 2019Active support untilNov 28, 2021Security fixes untilNov 28, 2022Last release7.4.33

Check which PHP version your site runs

What PHP 7.4 end of life means

PHP 7.4 was released on November 28, 2019, the last release of the PHP 7 series. Active support ended on November 28, 2021 and security support on November 28, 2022. Since then, every PHP vulnerability found, including the critical PHP2Shell bugs fixed on October 21, 2026, stays open on PHP 7.4.

Yet according to W3Techs, about one in five PHP websites still runs PHP 7.4, mostly older WordPress, Joomla and Magento installations and custom applications nobody wants to touch. Many hosts now charge extra for keeping it, and modern versions of almost every PHP library no longer install on it.

Moving from 7.4 to 8.x is a real upgrade, unlike the smaller steps after it. PHP 8.0 turned many warnings into errors and changed how strings and numbers compare. With the right order of work, it is still a project of days, not months, for most sites.

What PHP 7.4 added

The features that made 7.4 worth adopting. Each example opens in the sandbox on PHP 7.4; it runs on every later version too.

Typed properties

Class properties can declare a type, enforced by the engine.

<?php
class Product
{
    public int $id;
    public string $name;
    public ?float $price = null;
}

$p = new Product;
$p->id = 5;
$p->name = 'Book';
var_dump($p);
Run on PHP 7.4 →

Arrow functions and ??=

Short closures that capture variables automatically, and the null coalescing assignment operator.

<?php
$tax = 0.2;
$prices = [10, 20, 30];
$gross = array_map(fn($p) => $p * (1 + $tax), $prices);
echo implode(', ', $gross), PHP_EOL;

$config = [];
$config['locale'] ??= 'en_US';
echo $config['locale'];
Run on PHP 7.4 →

Spread in arrays and numeric separators

Unpack arrays inside array literals, and write large numbers readably.

<?php
$base = ['php', 'html'];
$all = [...$base, 'css', 'js'];
echo implode(' ', $all), PHP_EOL;

$budget = 1_000_000;
echo number_format($budget);
Run on PHP 7.4 →

PHP 8 changes that break PHP 7.4 code

The jump from 7.4 to 8.0 contains most of the breaking changes. Run each example on PHP 7.4 and then on 8.x in the sandbox to see the difference.

String to number comparisons

In PHP 8, 0 == "foo" is false; in PHP 7 it was true. Comparisons between numbers and non-numeric strings now compare as strings. This silently changes the result of loose comparisons, switch and in_array() without strict mode.

<?php
var_dump(0 == 'foo');
var_dump(in_array('abc', [0]));
switch (0) {
    case 'a': echo 'matched a'; break;
    default: echo 'default';
}

Run on PHP 7.4 →Run on PHP 8.0 →

Removed functions: each(), create_function() and more

each(), create_function(), money_format() and others were removed, and calling them is now a fatal error. Replace each() loops with foreach and create_function() with closures.

<?php
$arr = ['a' => 1, 'b' => 2];
while (list($k, $v) = each($arr)) {
    echo "$k=$v ";
}

Run on PHP 7.4 →Run on PHP 8.0 →

Curly brace string offsets

$str{0} was deprecated in 7.4 and is a parse error in PHP 8. Use $str[0].

<?php
$s = 'PHP';
echo $s{0};

Run on PHP 7.4 →Run on PHP 8.0 →

Warnings became errors

Many internal functions now throw TypeError or ValueError where they used to return null with a warning, for example strlen([]) or array_combine() with arrays of different lengths. Arithmetic on arrays and non-numeric strings throws as well.

<?php
try {
    echo strlen([]);
} catch (TypeError $e) {
    echo get_class($e), ': ', $e->getMessage();
}

Run on PHP 7.4 →Run on PHP 8.0 →

Unparenthesized nested ternaries

$a ? $b : $c ? $d : $e is a fatal error in PHP 8. Add parentheses to say what you mean.

Resources became objects

GD images, cURL handles and others are now objects (GdImage, CurlHandle). Code that checks is_resource($img) must check for the object or for false instead.

How to upgrade from PHP 7.4

  1. Inventory first. List every site on 7.4 with the PHP Version Checker or your hosting panel, along with its CMS, plugins and custom code.
  2. Update everything while still on 7.4. Update WordPress, Joomla or your framework and all plugins to the newest versions that still run on 7.4. Replace abandoned plugins.
  3. Scan the code. Run PHPCompatibility (phpcs --standard=PHPCompatibility --runtime-set testVersion 8.3-) or Rector's PHP 8 sets to find removed functions and syntax.
  4. Check loose comparisons. Search for == and in_array() without the strict flag where a value may be 0 or a non-numeric string.
  5. Test on staging with PHP 8.3 or 8.4. Turn on display_errors on staging only and go through checkout, forms, login and admin pages. Paste failing snippets into the compatibility checker to see exactly what each version says.
  6. Go live and watch logs. Switch the version, keep the old one available for a quick rollback, and monitor the error log for a week.

Not sure whether a piece of code survives the upgrade? The code compatibility checker runs it on PHP 7.4 through 8.5 at once and shows the errors and deprecations for each version. For dates of every other version, see the PHP EOL table.

Free PHP tools

Frequently asked questions

When did PHP 7.4 reach end of life?

On November 28, 2022, three years after its release. It has received no security fixes from the PHP project since then.

Is it dangerous to keep running PHP 7.4?

Yes, increasingly. Vulnerabilities found since 2022, including the critical PHP2Shell remote code execution bugs fixed in October 2026, are not patched in PHP 7.4. Unless your Linux distribution or a commercial vendor provides backported fixes, a public site on 7.4 is exposed.

Can I upgrade from PHP 7.4 directly to PHP 8.4?

Yes, and it is usually the best plan, since 8.0 to 8.2 are already end of life or close to it. Expect most of the work to come from the 8.0 changes; the later versions add mainly deprecations.

Will my WordPress site break on PHP 8?

WordPress core supports PHP 8. Problems almost always come from old plugins and themes. Update everything, deactivate what you do not need, and test on a staging site. Hosts like to offer a one-click staging copy for exactly this.

What replaced each() in PHP 8?

foreach. A loop like while (list($k, $v) = each($arr)) becomes foreach ($arr as $k => $v). If you need the internal pointer, use key(), current() and next().