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(); $container = new Container(); for ($i = 0; $i < 1000; $i++) { $container->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.3.10.0040.01116.64
7.3.00.0060.01016.43
7.2.130.0000.01417.07
7.2.120.0060.00916.57
7.2.110.0030.01216.68
7.2.100.0090.00916.98
7.2.90.0080.00316.78
7.2.80.0040.00717.00
7.2.70.0150.00316.80
7.2.60.0090.00616.96
7.2.50.0060.00616.97
7.2.40.0150.00317.13
7.2.30.0100.00317.18
7.2.20.0090.00616.77
7.2.10.0030.00617.00
7.2.00.0030.01118.37
7.1.250.0030.00615.61
7.1.70.0030.00717.15
7.1.60.0170.00719.32
7.1.50.0100.01034.75
7.1.00.0030.07322.48
7.0.200.0050.00516.91
7.0.140.0070.07022.00
7.0.100.0100.03720.51
7.0.90.0030.03320.39
7.0.80.0100.03720.44
7.0.70.0030.03320.33
7.0.60.0100.03020.34
7.0.50.0000.04020.71
7.0.40.0130.07720.09
7.0.30.0070.08720.05
7.0.20.0030.08720.13
7.0.10.0070.08720.13
7.0.00.0170.05720.02
5.6.280.0100.07021.53
5.6.250.0000.04021.18
5.6.240.0000.04021.21
5.6.230.0030.04021.20
5.6.220.0000.04321.04
5.6.210.0070.04021.16
5.6.200.0070.05021.57
5.6.190.0000.08721.54
5.6.180.0000.08321.59
5.6.170.0170.06021.54
5.6.160.0030.04721.63
5.6.150.0130.07721.56
5.6.140.0070.04721.52
5.6.130.0130.09321.64
5.6.120.0200.06721.54
5.6.110.0130.07721.61
5.6.100.0070.08321.58
5.6.90.0100.08021.59
5.6.80.0070.08020.94
5.6.70.0100.06720.91
5.6.60.0100.07020.98
5.6.50.0070.04320.86
5.6.40.0070.05020.89
5.6.30.0100.05720.91
5.6.20.0130.06320.91
5.6.10.0070.04321.04
5.6.00.0130.07020.96
5.5.380.0070.03020.96
5.5.370.0000.04020.93
5.5.360.0100.03320.86
5.5.350.0030.03720.89
5.5.340.0030.04021.44
5.5.330.0100.04721.41
5.5.320.0130.08321.32
5.5.310.0130.07721.24
5.5.300.0030.07721.27
5.5.290.0170.08021.40
5.5.280.0100.07021.40
5.5.270.0130.07721.38
5.5.260.0100.07721.36
5.5.250.0200.07321.19
5.5.240.0100.08020.78
5.5.230.0070.07320.86
5.5.220.0030.07320.63
5.5.210.0170.03720.72
5.5.200.0030.08720.76
5.5.190.0030.07720.66
5.5.180.0100.05720.70
5.5.160.0130.07320.66
5.5.150.0130.03720.78
5.5.140.0000.05020.59
5.5.130.0070.04020.62
5.5.120.0070.08720.77
5.5.110.0070.04720.54
5.5.100.0030.09320.49
5.5.90.0100.08320.58
5.5.80.0030.08720.67
5.5.70.0070.07720.57
5.5.60.0230.03320.62
5.5.50.0100.03720.57
5.5.40.0030.08320.61
5.5.30.0100.04020.57
5.5.20.0030.07720.59
5.5.10.0030.05320.57
5.5.00.0030.06020.63
5.4.450.0100.06319.84
5.4.440.0100.07319.63
5.4.430.0030.09019.81
5.4.420.0230.03319.82
5.4.410.0070.08019.50
5.4.400.0030.08019.64
5.4.390.0100.07319.43
5.4.380.0100.03719.44
5.4.370.0030.05019.59
5.4.360.0030.04319.48
5.4.350.0100.03719.48
5.4.340.0100.08319.35
5.4.320.0070.05319.35
5.4.310.0030.08319.40
5.4.300.0030.08319.34
5.4.290.0070.08319.44
5.4.280.0000.08019.50
5.4.270.0070.07319.62
5.4.260.0030.07719.66
5.4.250.0070.06719.47
5.4.240.0100.03319.48
5.4.230.0170.07719.55
5.4.220.0030.04319.44
5.4.210.0100.08319.47
5.4.200.0130.07319.55
5.4.190.0070.04019.49
5.4.180.0030.04319.65
5.4.170.0030.04319.33
5.4.160.0100.07719.31
5.4.150.0030.04319.86
5.4.140.0070.06316.69
5.4.130.0000.04316.83
5.4.120.0130.02716.82
5.4.110.0030.04316.96
5.4.100.0000.05016.85
5.4.90.0100.05716.91
5.4.80.0030.04716.80
5.4.70.0000.05316.81
5.4.60.0070.06316.94
5.4.50.0170.06316.75
5.4.40.0070.07016.93
5.4.30.0070.08716.92
5.4.20.0100.04316.89
5.4.10.0030.08316.79
5.4.00.0000.07716.16
5.3.290.0200.05715.33
5.3.280.0000.06015.24
5.3.270.0100.03715.43
5.3.260.0130.07315.23
5.3.250.0170.03315.28
5.3.240.0070.07015.41
5.3.230.0070.08015.40
5.3.220.0030.04315.22
5.3.210.0030.07315.32
5.3.200.0100.03715.23
5.3.190.0030.08015.23
5.3.180.0070.07015.21
5.3.170.0070.07715.37
5.3.160.0030.04015.19
5.3.150.0170.05315.38
5.3.140.0070.05715.37
5.3.130.0100.07015.21
5.3.120.0100.07715.30
5.3.110.0070.05315.27
5.3.100.0100.07014.80
5.3.90.0000.08014.77
5.3.80.0070.08314.76
5.3.70.0030.07714.82
5.3.60.0070.08014.69
5.3.50.0070.05014.64
5.3.40.0070.08314.71
5.3.30.0100.07014.65
5.3.20.0130.06714.53
5.3.10.0130.05714.34
5.3.00.0130.06714.36
5.2.170.0000.07011.55
5.2.160.0030.06311.54
5.2.150.0070.06011.46
5.2.140.0070.06011.37
5.2.130.0030.05311.32
5.2.120.0070.04011.33
5.2.110.0030.06011.44
5.2.100.0070.03311.80
5.2.90.0000.03311.55
5.2.80.0100.04711.43
5.2.70.0030.06711.45
5.2.60.0070.03011.46
5.2.50.0070.03011.46
5.2.40.0070.04011.23
5.2.30.0030.04711.34
5.2.20.0070.03011.58
5.2.10.0070.06011.14
5.2.00.0030.03010.82
5.1.60.0070.04310.00
5.1.50.0070.0639.99
5.1.40.0030.05710.08
5.1.30.0030.03010.43
5.1.20.0070.05010.21
5.1.10.0030.04710.08
5.1.00.0030.03010.15
5.0.50.0030.0279.24
5.0.40.0130.0239.24
5.0.30.0000.0679.24
5.0.20.0030.0209.24
5.0.10.0070.0479.24
5.0.00.0030.0509.24
4.4.90.0000.0179.24
4.4.80.0070.0279.24
4.4.70.0070.0339.24
4.4.60.0070.0279.24
4.4.50.0000.0209.24
4.4.40.0000.0579.24
4.4.30.0030.0379.24
4.4.20.0030.0239.24
4.4.10.0030.0239.24
4.4.00.0000.0579.24
4.3.110.0030.0379.24
4.3.100.0030.0339.24
4.3.90.0000.0179.24
4.3.80.0000.0439.24
4.3.70.0000.0179.24
4.3.60.0030.0239.24
4.3.50.0070.0309.24
4.3.40.0070.0209.24
4.3.30.0000.0409.24
4.3.20.0030.0139.24
4.3.10.0000.0179.24
4.3.00.0000.0409.24

preferences:
36.31 ms | 401 KiB | 5 Q