3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface response { public function getResponseClass(); } class foo implements response { public $type = 'foo'; public function getResponseClass() { return 'hello'; } } class bar implements response { public $type = 'bar'; public function getResponseClass() { return 'world'; } } class hello { } class world { } class process { public function test1($a) { switch ($a->type) { case 'foo': return new hello(); case 'bar': return new world(); } } public function test2($a) { return $a->getResponseClass() } } $p = new process; var_dump($p->test1(new bar())); var_dump($p->test2(new bar()));

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)
5.4.390.0170.07318.72
5.4.380.0230.06018.52
5.4.370.0170.06018.72
5.4.360.0230.05018.78
5.4.350.0230.06018.69
5.4.340.0170.06018.55
5.4.320.0100.06718.68
5.4.310.0200.05718.55
5.4.300.0370.07018.51
5.4.290.0230.05018.60
5.4.280.0230.04718.50
5.4.270.0370.03718.69
5.4.260.0230.04718.51
5.4.250.0130.06018.69
5.4.240.0200.05718.68
5.4.230.0200.05018.51
5.4.220.0170.06318.54
5.4.210.0130.06318.76
5.4.200.0230.04716.79
5.4.190.0270.04718.75
5.4.180.0070.06718.50
5.4.170.0230.06318.50
5.4.160.0270.04318.74
5.4.150.0200.05718.49
5.4.140.0270.04716.25
5.4.130.0170.05016.37
5.4.120.0300.03716.31
5.4.110.0130.05316.23
5.4.100.0300.04316.35
5.4.90.0130.06016.21
5.4.80.0230.04716.25
5.4.70.0170.05316.13
5.4.60.0170.05316.12
5.4.50.0170.05016.27
5.4.40.0130.05716.26
5.4.30.0300.04316.39
5.4.20.0130.06016.41
5.4.10.0230.04716.26
5.4.00.0200.05315.78
5.3.290.0230.05314.81
5.3.280.0230.05014.77
5.3.270.0230.05714.85
5.3.260.0270.05014.80
5.3.250.0230.05014.84
5.3.240.0070.07014.82
5.3.230.0170.06314.65
5.3.220.0230.05014.79
5.3.210.0330.04314.70
5.3.200.0230.06014.58
5.3.190.0300.06714.74
5.3.180.0270.04714.74
5.3.170.0400.05014.79
5.3.160.0130.06714.68
5.3.150.0130.06714.68
5.3.140.0170.06014.73
5.3.130.0200.05314.62
5.3.120.0130.06314.57
5.3.110.0130.06014.57
5.3.100.0200.05014.06
5.3.90.0130.05314.21
5.3.80.0170.05314.07
5.3.70.0200.05014.09
5.3.60.0330.04314.14
5.3.50.0270.04314.08
5.3.40.0070.06314.18
5.3.30.0270.05014.02
5.3.20.0100.07013.74
5.3.10.0370.03013.74
5.3.00.0200.05013.80
5.2.170.0130.04311.38
5.2.160.0130.04711.38
5.2.150.0230.03711.16
5.2.140.0200.04011.15
5.2.130.0200.04311.13
5.2.120.0030.05311.14
5.2.110.0270.03011.18
5.2.100.0070.05011.15
5.2.90.0230.04011.16
5.2.80.0170.04311.09
5.2.70.0200.05311.19
5.2.60.0170.04311.29
5.2.50.0130.04711.15
5.2.40.0300.02310.99
5.2.30.0130.05011.10
5.2.20.0270.03011.03
5.2.10.0200.03710.88
5.2.00.0100.04310.80
5.1.60.0100.03710.01
5.1.50.0130.03310.20
5.1.40.0230.03310.03
5.1.30.0170.03710.45
5.1.20.0100.04010.59
5.1.10.0170.03010.16
5.1.00.0100.04010.29
5.0.50.0030.0338.60
5.0.40.0070.0278.41
5.0.30.0100.0478.31
5.0.20.0070.0378.30
5.0.10.0100.0278.38
5.0.00.0130.0378.37
4.4.90.0030.0277.56
4.4.80.0070.0307.56
4.4.70.0100.0207.56
4.4.60.0070.0237.56
4.4.50.0130.0177.56
4.4.40.0100.0337.56
4.4.30.0070.0237.56
4.4.20.0070.0207.56
4.4.10.0170.0237.56
4.4.00.0070.0337.56
4.3.110.0130.0207.56
4.3.100.0070.0307.56
4.3.90.0130.0177.56
4.3.80.0030.0377.56
4.3.70.0070.0207.56
4.3.60.0070.0277.56
4.3.50.0070.0237.56
4.3.40.0130.0277.56
4.3.30.0030.0237.56
4.3.20.0100.0207.56
4.3.10.0030.0237.56
4.3.00.0200.0238.72

preferences:
150.69 ms | 1394 KiB | 7 Q