3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Cl { public $v = ['foo']; public function a(): array { return $this->v; } public function &b(): array { return $this->v; } } $o = new Cl(); $iters = 1_000_000; $t = microtime(true); for ($i = 0; $i < $iters; $i++) { $v1 = $o->a(); $v2 = $o->a(); $v3 = $o->a(); $v4 = $o->a(); $v1 = $o->a(); $v2 = $o->a(); $v3 = $o->a(); $v4 = $o->a(); } var_dump(microtime(true) - $t); $t = microtime(true); for ($i = 0; $i < $iters; $i++) { $v1 = $o->b(); $v2 = $o->b(); $v3 = $o->b(); $v4 = $o->b(); $v1 = $o->b(); $v2 = $o->b(); $v3 = $o->b(); $v4 = $o->b(); } var_dump(microtime(true) - $t);

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.2.10.0060.41617.56
8.2.00.0130.41617.74
8.1.140.0130.41917.34
8.1.130.0220.39917.39
8.1.120.0170.41617.36
8.1.110.0070.43817.36
8.1.100.0030.44417.47
8.1.90.0160.44717.45
8.1.80.0130.42217.46
8.1.70.0030.44217.41
8.1.60.0060.43817.64
8.1.50.0100.42717.50
8.1.40.0100.41117.56
8.1.30.0130.41317.65
8.1.20.0190.41417.57
8.1.10.0100.43617.48
8.1.00.0170.40717.46
8.0.270.0000.41716.82
8.0.260.0000.42016.68
8.0.250.0000.41916.70
8.0.240.0130.44616.81
8.0.230.0030.42516.76
8.0.220.0100.41716.75
8.0.210.0030.41816.63
8.0.200.0030.42616.77
8.0.190.0100.41316.73
8.0.180.0070.42016.79
8.0.170.0000.44916.76
8.0.160.0100.43416.84
8.0.150.0130.40516.80
8.0.140.0100.41416.70
8.0.130.0070.41416.69
8.0.120.0030.42116.68
8.0.110.0070.41116.62
8.0.100.0030.41416.76
8.0.90.0130.41016.75
8.0.80.0130.40616.75
8.0.70.0070.42016.75
8.0.60.0200.40016.63
8.0.50.0000.41616.66
8.0.30.0030.41816.66
8.0.20.0070.41016.79
8.0.10.0030.42316.88
7.0.00.0080.00316.55

preferences:
34.74 ms | 400 KiB | 5 Q