Paste PHP code to find the minimum PHP version it needs, and spot removed or deprecated features that break on newer PHP. Free, no sign-up, and your code never leaves your browser.
Your code is analyzed in your browser and never uploaded.
Want to know which PHP version a live website runs instead? Check a website URL.
Syntax, types, functions, classes and constants added in each version, from short arrays (5.4) to the pipe operator (8.5). The newest one found sets the minimum version.
Things that no longer exist, like mysql_*, ereg(), each() and create_function(). They cap the maximum version your code can run on.
Features that still work but trigger warnings, like utf8_encode(), "${var}" interpolation and implicitly nullable parameters.
A quick reference of common PHP features and the version that added them.
| Feature | Example | Minimum PHP |
|---|---|---|
| Pipe operator | $x |> trim(...) | PHP 8.5 |
| Property hooks | public string $n { get => … } | PHP 8.4 |
| Asymmetric visibility | public private(set) string $n | PHP 8.4 |
| Typed class constants | const string NAME = … | PHP 8.3 |
| Readonly classes | readonly class Point | PHP 8.2 |
| Enums | enum Status: string | PHP 8.1 |
| Readonly properties | public readonly int $id | PHP 8.1 |
| never return type | function stop(): never | PHP 8.1 |
| match expression | match ($x) { … } | PHP 8.0 |
| Nullsafe operator | $user?->name | PHP 8.0 |
| Named arguments | foo(name: "x") | PHP 8.0 |
| Union types | int|string $id | PHP 8.0 |
| Constructor promotion | function __construct(private int $x) | PHP 8.0 |
| str_contains() | str_contains($a, $b) | PHP 8.0 |
| Typed properties | private int $age; | PHP 7.4 |
| Arrow functions | fn($x) => $x * 2 | PHP 7.4 |
| Null coalescing assignment | $a ??= 1 | PHP 7.4 |
| Flexible heredoc | indented closing marker | PHP 7.3 |
| Nullable types | ?string $name | PHP 7.1 |
| void return type | function f(): void | PHP 7.1 |
| Scalar type declarations | function f(int $x) | PHP 7.0 |
| Null coalescing operator | $a ?? "default" | PHP 7.0 |
| Spaceship operator | $a <=> $b | PHP 7.0 |
| Variadic functions | function f(...$args) | PHP 5.6 |
| Short array syntax | [1, 2, 3] | PHP 5.4 |
This tool is ideal for snippets, single files and plugin code. To scan an entire codebase, use PHPCompatibility with PHP_CodeSniffer:
composer require --dev phpcompatibility/php-compatibility vendor/bin/phpcs -p . --standard=PHPCompatibility \ --runtime-set testVersion 8.3-
Then check your server with the PHP Version Checker and compare against the PHP support timeline.
Paste the code into the PHP Code Version Checker above and click "Check PHP version". It looks for syntax, functions, classes and constants that were added in specific PHP versions and reports the highest one, which is the minimum version your code needs.
A PHP compatibility checker scans PHP code for features that only exist in certain PHP versions. It tells you which versions the code can run on, and flags removed or deprecated features that will break or warn when you upgrade PHP.
No. The analysis runs entirely in your browser with JavaScript. Your code is never sent to a server.
It is a fast static check, not a full PHP parser, so treat the result as a strong estimate. It does not check PHP extensions, php.ini settings or Composer dependencies, which can raise the real minimum version. For a whole project, run PHPCompatibility with PHP_CodeSniffer.
Install PHPCompatibility with Composer (composer require --dev phpcompatibility/php-compatibility) and run vendor/bin/phpcs -p . --standard=PHPCompatibility --runtime-set testVersion 8.3-. For WordPress, use the phpcompatibility/phpcompatibility-wp ruleset.
Target a version that still receives security updates. See the PHP versions page for current support dates.