3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Service { public $class; public function __construct($class) { $this->class = $class; } } class Container { public $services = array(); } $start = memory_get_usage(); $container = new Container(); for ($i = 0; $i < 1000; $i++) { $container->services[] = new Service('Foo'.$i); } $delta = memory_get_usage() - $start; echo 'Memory usage of 1000 service objects: '.$delta, PHP_EOL; $start = memory_get_usage(); $container1 = new Container(); for ($i = 0; $i < 1000; $i++) { $container1->services[] = array('Foo'.$i); } $delta = memory_get_usage() - $start; echo 'Memory usage of 1000 service arrays: '.$delta;

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)
7.2.00.0030.00919.56
7.1.70.0040.00417.06
7.1.60.0030.02119.32
7.1.50.0110.01116.97
7.1.00.0030.06022.36
7.0.200.0030.00616.48
7.0.140.0070.07322.21
7.0.100.0130.07320.51
7.0.90.0030.08720.43
7.0.80.0130.08720.52
7.0.70.0170.07720.69
7.0.60.0000.09020.39
7.0.50.0030.07020.72
7.0.40.0000.05320.13
7.0.30.0130.07720.23
7.0.20.0030.05720.19
7.0.10.0070.07320.10
7.0.00.0100.06320.10
5.6.280.0130.08021.63
5.6.250.0070.08721.50
5.6.240.0100.05021.51
5.6.230.0100.08321.36
5.6.220.0070.05321.51
5.6.210.0100.07721.24
5.6.200.0200.07721.71
5.6.190.0130.08321.77
5.6.180.0130.07021.81
5.6.170.0100.08321.79
5.6.160.0000.09021.91
5.6.150.0070.07721.80
5.6.140.0070.05021.79
5.6.130.0100.08021.82
5.6.120.0170.06721.85
5.6.110.0030.08321.83
5.6.100.0130.07021.82
5.6.90.0000.05321.71
5.6.80.0000.05321.10
5.6.70.0100.05721.23
5.6.60.0170.06721.19
5.6.50.0100.08021.27
5.6.40.0200.05321.17
5.6.30.0070.08021.26
5.6.20.0270.04021.24
5.6.10.0100.07021.19
5.6.00.0170.05021.16
5.5.380.0100.08321.17
5.5.370.0070.08021.32
5.5.360.0100.08021.18
5.5.350.0070.06321.14
5.5.340.0100.06321.67
5.5.330.0070.08321.67
5.5.320.0100.07721.61
5.5.310.0030.08721.61
5.5.300.0130.07721.68
5.5.290.0070.08021.57
5.5.280.0070.08021.64
5.5.270.0030.08721.65
5.5.260.0170.07321.67
5.5.250.0030.09021.47
5.5.240.0100.06320.99
5.5.230.0130.07320.93
5.5.220.0070.07721.05
5.5.210.0030.05320.98
5.5.200.0030.08720.99
5.5.190.0130.07020.99
5.5.180.0100.07320.90
5.5.160.0130.07020.76
5.5.150.0100.06020.95
5.5.140.0070.08020.98
5.5.130.0100.07320.93
5.5.120.0070.08320.95
5.5.110.0200.06021.00
5.5.100.0070.07020.86
5.5.90.0070.05320.79
5.5.80.0100.07320.88
5.5.70.0170.07320.80
5.5.60.0100.07320.70
5.5.50.0100.04320.91
5.5.40.0200.03320.82
5.5.30.0100.04320.70
5.5.20.0070.08320.75
5.5.10.0030.05020.83
5.5.00.0200.07020.89
5.4.450.0100.07320.08
5.4.440.0100.07720.04
5.4.430.0070.08020.21
5.4.420.0030.07720.06
5.4.410.0100.07719.92
5.4.400.0030.08019.84
5.4.390.0030.05019.66
5.4.380.0130.06719.77
5.4.370.0130.06719.65
5.4.360.0200.04319.73
5.4.350.0100.07319.89
5.4.340.0000.08019.60
5.4.320.0030.08719.56
5.4.310.0030.06019.83
5.4.300.0070.08019.82
5.4.290.0070.07719.82
5.4.280.0130.07719.59
5.4.270.0070.07319.82
5.4.260.0070.07719.72
5.4.250.0130.07019.70
5.4.240.0000.08319.59
5.4.230.0230.05319.80
5.4.220.0030.05019.72
5.4.210.0100.07019.74
5.4.200.0070.08019.59
5.4.190.0170.06719.60
5.4.180.0100.07019.88
5.4.170.0030.07719.59
5.4.160.0030.04319.79
5.4.150.0130.04319.60
5.4.140.0030.07017.11
5.4.130.0130.06717.15
5.4.120.0070.05317.16
5.4.110.0030.07017.20
5.4.100.0070.05017.21
5.4.90.0030.07317.06
5.4.80.0000.07017.02
5.4.70.0070.04317.16
5.4.60.0100.05717.11
5.4.50.0000.05317.03
5.4.40.0070.06017.07
5.4.30.0030.03717.08
5.4.20.0030.05317.01
5.4.10.0000.05317.12
5.4.00.0070.04316.60
5.3.290.0070.08015.55
5.3.280.0070.07315.58
5.3.270.0100.07715.45
5.3.260.0030.07715.50
5.3.250.0100.07015.40
5.3.240.0070.06315.60
5.3.230.0200.06715.47
5.3.220.0130.06315.45
5.3.210.0100.06315.41
5.3.200.0130.03315.40
5.3.190.0030.06715.50
5.3.180.0070.05315.48
5.3.170.0100.07015.50
5.3.160.0100.08015.41
5.3.150.0130.07315.45
5.3.140.0070.06015.39
5.3.130.0100.07015.46
5.3.120.0100.05315.36
5.3.110.0070.04715.51
5.3.100.0100.07015.05
5.3.90.0130.04014.93
5.3.80.0100.03014.86
5.3.70.0000.06714.91
5.3.60.0070.03314.89
5.3.50.0170.05014.79
5.3.40.0100.06714.72
5.3.30.0070.05714.85
5.3.20.0070.05014.54
5.3.10.0030.07314.43
5.3.00.0070.07714.57
5.2.170.0000.07311.91
5.2.160.0100.05711.94
5.2.150.0070.06311.80
5.2.140.0000.03711.98
5.2.130.0070.06011.69
5.2.120.0000.05011.82
5.2.110.0070.06011.81
5.2.100.0100.06011.66
5.2.90.0130.05311.87
5.2.80.0030.06711.90
5.2.70.0070.05711.80
5.2.60.0030.06711.61
5.2.50.0100.06311.78
5.2.40.0070.06311.79
5.2.30.0070.06311.66
5.2.20.0000.04311.89
5.2.10.0030.06011.52
5.2.00.0000.06310.64
5.1.60.0070.04310.00
5.1.50.0100.04310.06
5.1.40.0030.04310.05
5.1.30.0130.04710.32
5.1.20.0030.05710.31
5.1.10.0000.0579.96
5.1.00.0030.05310.19
5.0.50.0030.0478.64
5.0.40.0100.0378.46
5.0.30.0070.0578.25
5.0.20.0030.0438.31
5.0.10.0030.0338.19
5.0.00.0070.0508.09
4.4.90.0000.0378.09
4.4.80.0030.0278.09
4.4.70.0030.0338.09
4.4.60.0030.0208.09
4.4.50.0030.0378.09
4.4.40.0000.0578.09
4.4.30.0030.0338.09
4.4.20.0130.0238.09
4.4.10.0000.0378.09
4.4.00.0030.0508.09
4.3.110.0000.0238.09
4.3.100.0070.0238.09
4.3.90.0030.0338.09
4.3.80.0000.0378.09
4.3.70.0030.0138.09
4.3.60.0070.0308.09
4.3.50.0000.0338.09
4.3.40.0000.0438.09
4.3.30.0030.0338.09
4.3.20.0000.0378.09
4.3.10.0000.0178.09
4.3.00.0000.0208.09

preferences:
35.07 ms | 400 KiB | 5 Q