PHP Reference ยท Concepts and Reference
PHP version history: 8.0 to 8.5
A guide to PHP 8.0, 8.1, 8.2, 8.3, 8.4 and 8.5: the main features of each release, the support lifecycle, and how to check versions in code.
PHP releases a minor version every November. Each one is supported for two years with bug fixes and for two more years with security fixes only; after that it gets nothing, and running it is a risk. Minor versions in the 8.x series are mostly compatible, but each deprecates a few things that will be removed in a later major version.
This page lists the headline features of PHP 8.0 to 8.5, so you can see which language feature needs which version. Use it together with the version notes on individual reference pages.
if (version_compare(PHP_VERSION, '8.4.0', '>=')) { // property hooks available }
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with fgets(STDIN)), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with fgets(STDIN)), it gets the next line from this box.
Release highlights
| Version | Released | Main additions |
|---|---|---|
| 8.0 | Nov 2020 | JIT compiler, union types, match, named arguments, constructor promotion, nullsafe ?->, attributes, str_contains() family, static return type, WeakMap. Most warnings became TypeError and ValueError. |
| 8.1 | Nov 2021 | Enums, readonly properties, first-class callable syntax f(...), never type, new in initializers, pure intersection types, fibers, array_is_list(). |
| 8.2 | Dec 2022 | Readonly classes, null, false and true standalone types, DNF types, Random\Randomizer, sensitive-parameter attribute; dynamic properties deprecated. |
| 8.3 | Nov 2023 | Typed class constants, #[\Override], json_validate(), dynamic class-constant fetch, Randomizer::getBytesFromString(), deep-clone with readonly via __clone. |
| 8.4 | Nov 2024 | Property hooks, asymmetric visibility (public private(set)), new without extra parentheses, array_find(), array_any(), array_all(), lazy objects, #[\Deprecated], HTML5 DOM parser (Dom\HTMLDocument). Implicit nullable types deprecated. |
| 8.5 | Nov 2025 | Pipe operator |>, array_first() and array_last(), #[\NoDiscard], closures in constant expressions, URI extension, clone with property overrides. |
Usage notes
- Support windows: check the official supported-versions page before choosing a version for a new project. Pick the newest stable release your hosting and packages allow.
- Upgrade one minor at a time. Enable
E_DEPRECATEDand run your tests: deprecation notices in one version are errors in a future major. - Declare it in Composer:
"require": {"php": "^8.4"}stops installs on older servers. See Composer. - Feature-detect when a library must support several versions:
function_exists('array_find')orPHP_VERSION_ID. Polyfill packages (symfony/polyfill-php84) backport simple functions. - Static analysis (PHPStan, Psalm) and automated refactoring (Rector) find upgrade problems in bulk.
- Removed or deprecated things are collected in Deprecated and removed features.
- Behavior changes are listed in each version's migration guide: read it before upgrading. Typical ones are stricter type errors, changed defaults (such as the bcrypt cost in 8.4) and removed extensions.
- Faster, free: each release usually improves speed and memory, so upgrading is often the cheapest performance gain.