3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Test; class String { private $string; public function __construct($string) { if (!is_string($string)) { throw new \InvalidArgumentException(); } $this->string = $string; } public function __toString() { return $this->string; } } class A { public function a($string) { return $string; } } $a = new A(); for ($i = 0; $i < 1000000; $i++) { $string = 'a'; $a->a($string); }

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.6.280.0100.23720.98
5.6.210.0030.19720.57
5.6.200.0100.20018.18
5.6.190.0070.21320.50
5.6.180.3870.13720.48
5.6.170.0370.18720.50
5.6.160.0100.19020.50
5.6.150.0070.15718.17
5.6.140.0100.19718.25
5.6.130.0030.17718.16
5.6.120.0070.19021.13
5.6.110.0100.21021.12
5.6.100.0300.17021.11
5.6.90.0030.16320.97
5.6.80.0170.15020.42
5.6.70.0370.18020.38
5.5.350.0030.14320.39
5.5.340.0070.19717.95
5.5.330.0100.17320.17
5.5.320.0270.19720.42
5.5.310.0200.20020.24
5.5.300.0130.18718.07
5.5.290.0030.14017.96
5.5.280.0070.18020.66
5.5.270.0070.19720.87
5.5.260.0100.17020.98
5.5.250.0230.20320.47
5.5.240.0100.20020.35
5.4.450.0770.21019.58
5.4.440.0130.21319.38
5.4.430.0330.23719.57
5.4.420.0930.31719.56
5.4.410.0200.19019.48
5.4.400.2300.00018.90
5.4.390.2400.00018.51
5.4.380.0470.30718.80
5.4.370.0400.21718.73
5.4.360.0330.18318.63
5.4.350.0330.18718.74
5.4.340.0200.19718.62
5.4.320.0080.13812.50
5.4.310.0130.21012.50
5.4.300.0060.14912.50
5.4.290.0090.20712.50
5.4.280.0110.13712.40
5.4.270.0060.14012.40
5.4.260.0040.15212.39
5.4.250.0090.20112.39
5.4.240.0080.14412.40
5.4.230.0040.14612.39
5.4.220.0060.14312.39
5.4.210.0050.14412.39
5.4.200.0090.15712.39
5.4.190.0070.22318.75
5.4.180.0070.19318.81
5.4.170.0070.21018.71
5.4.160.0000.21018.97
5.4.150.0100.23018.61
5.4.140.0070.19716.36
5.4.130.0130.23016.44
5.4.120.0130.21016.59
5.4.110.0130.19716.52
5.4.100.0270.23016.58
5.4.90.0030.19716.36
5.4.80.0070.24016.35
5.4.70.0100.18716.63
5.4.60.0130.21316.29
5.4.50.0070.20016.60
5.4.40.0100.22016.51
5.4.30.0030.21016.45
5.4.20.0100.21716.36
5.4.10.0130.19316.42
5.4.00.0130.21315.84
5.3.290.0110.30012.80
5.3.280.0060.26312.71
5.3.270.0200.32314.60
5.3.260.0030.35314.71
5.3.250.0100.29714.70
5.3.240.0070.40314.52
5.3.230.0070.28014.74
5.3.220.0070.48314.56
5.3.210.0200.32714.57
5.3.200.0070.37314.80
5.3.190.0170.46014.59
5.3.180.0130.29014.61
5.3.170.0100.27714.66
5.3.160.0170.36014.63
5.3.150.0100.42314.75
5.3.140.0100.27714.39
5.3.130.0070.30314.46
5.3.120.0170.40014.55
5.3.110.0100.27314.71
5.3.100.0170.29714.22
5.3.90.0200.38014.10
5.3.80.0030.33014.10
5.3.70.0200.52313.85
5.3.60.0070.43714.08
5.3.50.0030.38013.97
5.3.40.0170.26314.05
5.3.30.0070.37014.00
5.3.20.0000.34013.69
5.3.10.0170.38313.87
5.3.00.0070.35713.73
5.2.170.0000.04710.98
5.2.160.0000.06011.15
5.2.150.0100.04011.04
5.2.140.0130.03311.15
5.2.130.0070.05311.10
5.2.120.0070.03711.02
5.2.110.0070.04010.93
5.2.100.0070.04011.11
5.2.90.0200.06011.02
5.2.80.0000.04710.99
5.2.70.0130.03711.02
5.2.60.0030.04711.05
5.2.50.0100.04010.94
5.2.40.0070.05310.88
5.2.30.0070.04310.97
5.2.20.0070.03710.84
5.2.10.0170.02710.94
5.2.00.0030.05010.94
5.1.60.0030.0339.88
5.1.50.0070.03010.14
5.1.40.0130.0279.89
5.1.30.0030.05710.41
5.1.20.0130.03010.29
5.1.10.0070.03010.02
5.1.00.0070.03010.27
5.0.50.0100.0338.73
5.0.40.0000.0338.46
5.0.30.0000.0437.99
5.0.20.0070.0278.20
5.0.10.0030.0278.20
5.0.00.0070.0438.20
4.4.90.0070.0177.20
4.4.80.0100.0137.20
4.4.70.0070.0177.20
4.4.60.0000.0237.20
4.4.50.0000.0237.20
4.4.40.0070.0437.20
4.4.30.0000.0237.20
4.4.20.0070.0177.20
4.4.10.0000.0277.20
4.4.00.0030.0307.20
4.3.110.0070.0177.20
4.3.100.0000.0337.20
4.3.90.0070.0237.20
4.3.80.0070.0377.20
4.3.70.0000.0277.20
4.3.60.0030.0277.20
4.3.50.0000.0277.20
4.3.40.0030.0307.20
4.3.30.0000.0237.20
4.3.20.0000.0237.20
4.3.10.0030.0207.20
4.3.00.0100.0236.97

preferences:
135.69 ms | 1394 KiB | 7 Q