Test PHP deprecations safely: multi-version comparison in one click
Upgrading PHP is mostly about one question: what breaks? Deprecations, removed functions, and quiet behaviour changes are easy to miss until production tells you about them. The fastest way to find them is to run the same code on the old version and the new version and compare. php.onl makes that a one-click operation.
The problem with "it works on my version"
A snippet that runs cleanly on PHP 8.1 might emit a deprecation notice on 8.4 and a fatal error on a future release. Conversely, code that uses brand-new syntax fails to even parse on older versions. Reasoning about this from changelogs is slow and error-prone. Running it is instant and certain.
Run one snippet on many versions, in parallel
In php.onl, the version selector is multi-select. Tick several versions, press Run once, and your snippet executes on all of them at the same time. The results panel shows each version's output together and raises a banner when the outputs differ — so a deprecation that only appears on the newer runtime is impossible to overlook.
Try this classic example. It relies on implicitly nullable parameter types, which became deprecated in PHP 8.4:
<?php
function greet(string $name = null) {
return "Hello, " . ($name ?? "world");
}
echo greet(), PHP_EOL;
Select 8.3 and 8.4 together and run it. On 8.3 it is
silent; on 8.4 you will see the deprecation notice about the implicitly nullable string $name = null parameter. That single diff is the entire signal you need before upgrading.
A practical upgrade workflow
- Pick your baseline and target. Select the version you run in production today and the one you want to move to.
- Run your snippet on both. Watch for the "outputs differ" banner.
- Read the new warnings. Deprecation and notice text is the upgrade's to-do list.
- Fix and re-run. Iterate until the target version is as quiet as the baseline.
- Spot-check across the range. Add a third version to confirm a fix holds.
Why do it in php.onl
- Private — your code runs locally via WebAssembly and is never sent to a server, so it is safe for real, proprietary code. See privacy.
- No setup — no Docker, no multiple local PHP installs, no version managers. Every version from 7.2 to 8.5 is one click away on the versions page.
- Offline — once a runtime is cached, the whole comparison works with no connection.
Ready to pressure-test your next upgrade? Open the playground → and select a couple of versions.