---
title: "Testing php code for different php versions online"
description: "You can test your php code for different php version online. Sometimes you have to test your code on different php versions."
url: "https://brocksi.net/blog/testing-php-code-for-different-php-versions-online/"
author: "Björn Meyer"
published: "2017-09-15"
updated: "2026-10-13"
lang: "en"
categories: ["PHP"]
---

# 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**](https://3v4l.org/ "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](https://brocksi.net/.netlify/images?url=_astro%2F36b88fa6-0634-4619-85c1-e09f55efc79atesting-php-code-for-different-versions-online.WpvGi9hU.png&w=1091&h=1264&dpl=6ad0d56685a41fcf66afb96c)

[**view json\_decode example online**](https://3v4l.org/QvU2D "view json_decode example online")
