3v4l.org

run code in 300+ PHP versions simultaneously
<?php function volume(int $x, int $y, int $z): int { return $x * $y * $z; } class Action { public function volume(int $x, int $y, int $z): int { return $x * $y * $z; } static public function vol(int $x, int $y, int $z): int { return $x * $y * $z; } } function normalize(callable $callable) : ReflectionFunctionAbstract { return $callable instanceof \Partial ? new ReflectionPartial($callable) : new ReflectionFunction(Closure::fromCallable($callable)); }; $p = volume(3, 5, ?); $r1 = normalize($p); print $r1->getReturnType() . PHP_EOL; $r2 = normalize('volume'); print $r2->getReturnType() . PHP_EOL; $a = new Action(); $r3 = normalize([$a, 'volume']); print $r3->getReturnType() . PHP_EOL; $r4 = normalize(fn($z): int => volume(3, 5, $z)); print $r4->getReturnType() . PHP_EOL;

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.0.30.0130.01016.84
8.0.20.0150.00716.99
8.0.10.0090.00916.86
8.0.00.0150.00916.89
7.4.160.0110.00616.38
7.4.150.0160.00616.31
7.4.140.0130.00616.49
7.4.130.0060.01616.28
7.4.120.0100.01016.20
7.4.110.0060.01116.22
7.4.100.0100.00716.45
7.4.90.0180.00416.36
7.4.80.0170.00316.31
7.4.70.0090.00616.22
7.4.60.0090.01316.27
7.4.50.0090.00616.32
7.4.40.0060.00916.15
7.4.30.0140.00616.43
7.4.20.0070.01516.32
7.4.10.0060.01616.29
7.4.00.0070.01116.32
7.3.270.0070.01416.11
7.3.260.0130.00616.13
7.3.250.0070.01316.11
7.3.240.0070.01316.15
7.3.230.0030.01416.20
7.3.220.0040.01616.08
7.3.210.0030.01716.12
7.3.200.0160.00316.07
7.3.190.0060.00916.09
7.3.180.0060.01416.13
7.3.170.0110.01116.05
7.3.160.0090.00616.15
7.3.150.0100.01016.23
7.3.140.0120.00716.16
7.3.130.0060.01216.14
7.3.120.0100.01016.12
7.3.110.0060.01316.07
7.3.100.0120.00316.02
7.3.90.0100.01016.30
7.3.80.0090.00916.07
7.3.70.0060.01616.14
7.3.60.0030.01716.16
7.3.50.0110.01016.21
7.3.40.0110.00816.13
7.3.30.0130.00316.16
7.3.20.0140.00416.17
7.3.10.0080.01216.23
7.3.00.0000.01516.18

preferences:
153.36 ms | 1288 KiB | 7 Q