Testing php code for different php versions online



Sometimes you have to test your code on different php versions.

There are multiple solutions to do this:

  • You can setup different php versions on your local (maybe virtual) machine and test every version one by one.
  • You can run a code analyser in your ide to find problems.
  • You can run a single version locally with the official Docker image, e.g. docker run --rm -v "$PWD":/app -w /app php:8.4-cli php test.php.

And you can test easily some (critical) parts of your application in a nice online editor like:

3v4l.org

The fun stuff is that you see exactly what every version will output or what kind of errors are thrown. It covers 500+ PHP versions (end-of-life versions on request). HHVM was removed in 2019, when HHVM dropped PHP support.

Here is an screen from the website about a json_decode example (link below the image)

Testing php code for different php versions online

view json_decode example online

Comments 💬 & Reactions ✨