3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static function test() { return true; } } function test() { static $a; return $a ??= new A; } $its = 1e3; $test = test(); $t = hrtime(true); for ( $i=0;$i++<$its;) test()->test(); echo (hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) $test->test(); echo (hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) A::test(); echo (hrtime(true)-$t)/1e9,"s\n"; echo "\n=== Warmed up ===\n\n"; $its = 1e6; $t = hrtime(true); for ( $i=0;$i++<$its;) test()->test(); echo $a=(hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) $test->test(); echo $b=(hrtime(true)-$t)/1e9,"s\n"; $t = hrtime(true); for ( $i=0;$i++<$its;) A::test(); echo $c=(hrtime(true)-$t)/1e9,"s\n"; echo number_format((($a-$c)/$a) * 100, 2 ), "% faster from function\n"; echo number_format((($b-$c)/$b) * 100, 2 ), "% faster from variable\n";

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.00.0120.09120.20
8.4.150.0020.00014.05
8.4.140.0150.09517.77
8.4.130.0080.05217.44
8.4.120.0100.04622.24
8.4.110.0100.05119.04
8.4.100.0030.03917.64
8.4.90.0130.05918.71
8.4.80.0060.04017.80
8.4.70.0100.06917.80
8.4.60.0140.05619.05
8.4.50.0120.06620.39
8.4.40.0130.06517.74
8.4.30.0130.06418.77
8.4.20.0070.04919.75
8.4.10.0030.05919.43
8.3.280.0120.08718.30
8.3.270.0110.10816.62
8.3.260.0100.05616.62
8.3.250.0110.06019.11
8.3.240.0070.06416.58
8.3.230.0040.04116.52
8.3.220.0080.05917.13
8.3.210.0120.07816.52
8.3.200.0060.05016.79
8.3.190.0090.06817.22
8.3.180.0080.06416.61
8.3.170.0030.05117.06
8.3.160.0100.06417.17
8.3.150.0030.05120.91
8.3.140.0070.05019.08
8.3.130.0100.07618.50
8.3.120.0070.05118.94
8.3.110.0070.04716.50
8.3.100.0100.04524.06
8.3.90.0060.04726.77
8.3.80.0100.05617.97
8.3.70.0170.10116.50
8.3.60.0100.10716.63
8.3.50.0170.10416.41
8.3.40.0030.10520.40
8.3.30.0030.09819.22
8.3.20.0160.07224.18
8.3.10.0100.08024.66
8.3.00.0060.04926.16
8.2.290.0050.06020.57
8.2.280.0080.06718.78
8.2.270.0130.05217.35
8.2.260.0060.04919.28
8.2.250.0100.04516.75
8.2.240.0130.10717.35
8.2.230.0030.05120.94
8.2.220.0060.05437.54
8.2.210.0030.05326.77
8.2.200.0030.06418.16
8.2.190.0130.11818.39
8.2.180.0100.09216.75
8.2.170.0170.15319.09
8.2.160.0200.09622.96
8.2.150.0000.05425.66
8.2.140.0030.05324.66
8.2.130.0130.07226.16
8.2.120.0100.06920.91
8.2.110.0070.08820.64
8.2.100.0340.05918.44
8.2.90.0270.06718.44
8.2.80.0220.06718.44
8.2.70.0280.06418.44
8.2.60.0230.06418.44
8.2.50.0210.07118.44
8.2.40.0270.06118.44
8.2.30.0260.06218.44
8.2.20.0220.06518.44
8.2.10.0170.07118.44
8.2.00.0130.07318.44
8.1.330.0080.06116.21
8.1.320.0090.07816.16
8.1.310.0070.07018.31
8.1.300.0100.04818.09
8.1.290.0070.06230.84
8.1.280.0160.08925.92
8.1.270.0060.04824.66
8.1.260.0030.05126.35
8.1.250.0030.05028.09
8.1.240.0100.08619.16
8.1.230.0220.06418.44
8.1.220.0180.06818.44
8.1.210.0240.06418.44
8.1.200.0140.07218.44
8.1.190.0250.06118.44
8.1.180.0210.06618.44
8.1.170.0300.06018.44
8.1.160.0270.06118.44
8.1.150.0200.06618.44
8.1.140.0230.06518.44
8.1.130.0310.06018.44
8.1.120.0140.07318.44
8.1.110.0210.06718.44
8.1.100.0290.06018.44
8.1.90.0160.06918.44
8.1.80.0250.06318.44
8.1.70.0210.06918.44
8.1.60.0240.06618.44
8.1.50.0260.06118.44
8.1.40.0230.06818.44
8.1.30.0220.07118.44
8.1.20.0170.07118.44
8.1.10.0240.06518.44
8.1.00.0130.07118.44
8.0.300.0150.08118.44
8.0.290.0220.06718.44
8.0.280.0210.06918.44
8.0.270.0110.07718.44
8.0.260.0200.07518.44
8.0.250.0150.07218.44
8.0.240.0200.06818.44
8.0.230.0270.06218.44
8.0.220.0250.06518.44
8.0.210.0240.06518.44
8.0.200.0230.06618.44
8.0.190.0200.06918.44
8.0.180.0260.06218.44
8.0.170.0290.05918.44
8.0.160.0210.06918.44
8.0.150.0210.06918.44
8.0.140.0290.06418.44
8.0.130.0250.06118.44
8.0.120.0310.05918.44
8.0.110.0250.06118.44
8.0.100.0270.06118.44
8.0.90.0310.05518.44
8.0.80.0210.06618.44
8.0.70.0200.06718.44
8.0.60.0240.06718.44
8.0.50.0270.06218.44
8.0.30.0210.06618.44
8.0.20.0270.06418.44
8.0.10.0210.06618.44

preferences:
32.05 ms | 403 KiB | 5 Q