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 $string) { return $string; } } //$a = new A(); $arr = array(); for ($i = 0; $i < 100000; $i++) { $string = new String('a'); $arr[] = $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.0130.15354.62
5.6.210.0100.10053.57
5.6.200.0100.12351.02
5.6.190.0230.15053.38
5.6.180.0530.12753.11
5.6.170.0570.12353.25
5.6.160.0100.12353.28
5.6.150.0230.14050.91
5.6.140.0100.09051.08
5.6.130.0100.11051.05
5.6.120.0130.16353.92
5.6.110.0230.12053.92
5.6.100.0300.12353.93
5.6.90.0130.10753.89
5.6.80.0300.13353.43
5.6.70.0500.07753.29
5.5.350.0330.14053.36
5.5.340.0030.10750.88
5.5.330.0070.11053.16
5.5.320.0230.10055.11
5.5.310.0330.09753.06
5.5.300.0300.10750.91
5.5.290.0130.14750.71
5.5.280.0070.15053.69
5.5.270.0100.10753.79
5.5.260.0200.14353.79
5.5.250.0270.14753.50
5.5.240.0100.09053.11
5.4.450.0370.14352.41
5.4.440.0270.10752.27
5.4.430.0570.13052.27
5.4.420.0400.14052.27
5.4.410.0670.09352.28
5.4.400.0400.12752.17
5.4.390.0570.12051.95
5.4.380.0500.10751.87
5.4.370.0400.08752.17
5.4.360.0470.10051.71
5.4.350.0330.09751.98
5.4.340.0430.14351.95
5.4.320.0400.13351.92
5.4.310.0370.13352.09
5.4.300.0500.11751.73
5.4.290.0400.11051.71
5.4.280.0400.13351.93
5.4.270.0470.13351.84
5.4.260.0400.13751.95
5.4.250.0330.12051.73
5.4.240.0430.12052.08
5.4.230.0330.08751.94
5.4.220.0370.08352.07
5.4.210.0300.13351.70
5.4.200.0270.09351.92
5.4.190.0430.11052.05
5.4.180.0230.10052.01
5.4.170.0570.11051.83
5.4.160.0300.11751.71
5.4.150.0330.13751.89
5.4.140.0270.09049.22
5.4.130.0370.08049.56
5.4.120.0370.12349.22
5.4.110.0270.09049.30
5.4.100.0370.08049.34
5.4.90.0230.09349.46
5.4.80.0300.08349.44
5.4.70.0300.12049.33
5.4.60.0370.09049.42
5.4.50.0370.09749.27
5.4.40.0370.08049.32
5.4.30.0330.08749.31
5.4.20.0300.08749.26
5.4.10.0370.09749.43
5.4.00.0300.10048.71
5.3.290.0370.12772.84
5.3.280.0300.16772.87
5.3.270.0630.15372.92
5.3.260.0430.17072.95
5.3.250.0430.11372.95
5.3.240.0370.13072.79
5.3.230.0830.12372.79
5.3.220.0230.19072.75
5.3.210.0300.15372.95
5.3.200.0530.10372.83
5.3.190.0470.11072.80
5.3.180.0500.10372.72
5.3.170.0330.12073.04
5.3.160.0370.13072.91
5.3.150.0370.17372.82
5.3.140.0270.13372.81
5.3.130.0370.12072.80
5.3.120.0230.13072.90
5.3.110.0370.12772.71
5.3.100.0430.11772.48
5.3.90.0330.12072.25
5.3.80.0170.14072.29
5.3.70.0370.12772.20
5.3.60.0500.11072.18
5.3.50.0430.13772.22
5.3.40.0370.12072.23
5.3.30.0400.17372.02
5.3.20.0600.15071.98
5.3.10.0470.11371.84
5.3.00.0230.13371.80
5.2.170.0130.03010.98
5.2.160.0130.03311.00
5.2.150.0130.04011.01
5.2.140.0170.03710.98
5.2.130.0230.02011.12
5.2.120.0200.03711.15
5.2.110.0230.05011.14
5.2.100.0170.02711.20
5.2.90.0200.05711.04
5.2.80.0200.06011.14
5.2.70.0230.06011.03
5.2.60.0170.03311.20
5.2.50.0230.06011.07
5.2.40.0170.04711.00
5.2.30.0170.03710.83
5.2.20.0200.06010.98
5.2.10.0170.05710.81
5.2.00.0200.04010.68
5.1.60.0170.0239.93
5.1.50.0330.0339.97
5.1.40.0230.0539.99
5.1.30.0200.05710.25
5.1.20.0300.04010.37
5.1.10.0230.0509.96
5.1.00.0230.05010.04
5.0.50.0170.0379.84
5.0.40.0100.0279.84
5.0.30.0130.0609.84
5.0.20.0130.0379.84
5.0.10.0130.0279.84
5.0.00.0100.0639.84
4.4.90.0100.0279.84
4.4.80.0070.0179.84
4.4.70.0100.0379.84
4.4.60.0100.0379.84
4.4.50.0170.0239.84
4.4.40.0130.0509.84
4.4.30.0130.0339.84
4.4.20.0130.0339.84
4.4.10.0100.0379.84
4.4.00.0100.0539.84
4.3.110.0100.0279.84
4.3.100.0170.0139.84
4.3.90.0170.0279.84
4.3.80.0130.0339.84
4.3.70.0200.0239.84
4.3.60.0100.0279.84
4.3.50.0130.0309.84
4.3.40.0100.0409.84
4.3.30.0030.0309.84
4.3.20.0030.0379.84
4.3.10.0030.0309.84
4.3.00.0070.0339.84

preferences:
146.06 ms | 1386 KiB | 7 Q