3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{"1": "a"}'; $jsonValidate = function (string $json, int $depth = 512, int $flags = 0) { if (function_exists('json_validate')) { return json_validate($json, $depth, $flags); } $maxDepth = 0x7fffffff; if (0 !== $flags && \defined('JSON_INVALID_UTF8_IGNORE') && \JSON_INVALID_UTF8_IGNORE !== $flags) { throw new \ValueError('json_validate(): Argument #3 ($flags) must be a valid flag (allowed flags: JSON_INVALID_UTF8_IGNORE)'); } if ($depth <= 0) { throw new \ValueError('json_validate(): Argument #2 ($depth) must be greater than 0'); } if ($depth > $maxDepth) { throw new \ValueError(sprintf('json_validate(): Argument #2 ($depth) must be less than %d', $maxDepth)); } json_decode($json, true, $depth, $flags); return \JSON_ERROR_NONE === json_last_error(); }; echo (int) $jsonValidate($json); var_dump($jsonValidate(...)); // error when function not exists var_dump(json_validate(...));

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.10.0100.00716.61
8.5.00.0110.01123.14
8.4.160.0140.01023.73
8.4.150.0070.00616.78
8.4.140.0110.01017.45
8.4.130.0140.00717.62
8.4.120.0410.01117.41
8.4.110.0390.01217.87
8.4.100.0430.00717.46
8.4.90.0410.00917.97
8.4.80.0620.00817.51
8.4.70.0390.01117.43
8.4.60.0450.00817.58
8.4.50.0360.01317.52
8.4.40.0440.01117.39
8.4.30.0450.00917.33
8.4.20.0450.00917.68
8.4.10.0390.00817.54
8.3.290.0120.01120.90
8.3.280.0020.00114.05
8.3.270.0130.00716.56
8.3.260.0120.00716.70
8.3.250.0290.01016.57
8.3.240.0330.00516.35
8.3.230.0170.00416.67
8.3.220.0290.00416.31
8.3.210.0370.00716.15
8.3.200.0410.00716.43
8.3.190.0370.01016.51
8.3.180.0290.00316.57
8.3.170.0420.00915.96
8.3.160.0440.01216.46
8.3.150.0360.00816.63
8.3.140.0280.00716.41
8.3.130.0320.00416.54
8.3.120.0420.00416.19
8.3.110.0370.00916.39
8.3.100.0430.01016.27
8.3.90.0470.00916.25
8.3.80.0460.00916.30
8.3.70.0380.00916.49
8.3.60.0310.00816.52
8.3.50.0220.00416.59
8.3.40.0330.00917.30
8.3.30.0310.01117.19
8.3.20.0410.00517.62
8.3.10.0220.00417.46
8.3.00.0310.00717.47
8.2.300.0100.01020.30
8.2.290.0300.01016.88
8.2.280.0350.00716.34
8.2.270.0310.00616.64
8.2.260.0140.00616.73
8.2.250.0170.00416.75
8.2.240.0170.00316.40
8.2.230.0170.00416.33
8.2.220.0200.00316.34
8.2.210.0170.00316.20
8.2.200.0160.00516.40
8.2.190.0180.00316.81
8.2.180.0180.00216.43
8.2.170.0180.00417.41
8.2.160.0190.00617.79
8.2.150.0210.00517.70
8.2.140.0190.00817.39
8.2.130.0170.00617.30
8.2.120.0180.00417.62
8.2.110.0180.00617.43
8.2.100.0180.00417.59
8.2.90.0210.00317.48
8.2.80.0180.00417.32
8.2.70.0190.00517.40
8.2.60.0180.00717.47
8.2.50.0190.00417.41
8.2.40.0160.00517.65
8.2.30.0160.00317.68
8.2.20.0190.00417.38
8.2.10.0180.00417.39
8.2.00.0180.00417.74
8.1.340.0110.00921.64

preferences:
42.72 ms | 403 KiB | 5 Q