3v4l.org

run code in 300+ PHP versions simultaneously
<?php class GrandPa { protected $elements = array( 'a' => 1, 'b' => 2, ); public function mergeElements($childElements = null) { $elements = $this->elements; $parentClassName = get_parent_class($this); if($parentClassName){ $parentClass = new $parentClassName(); if($childElements){ $elements = array_merge($elements, $childElements); } return $parentClass->mergeElements($elements); } else { return array_merge($elements, $childElements); } } } class Father extends GrandPa { protected $elements = array( 'c' => 3, ); } class Me extends Father{ protected $elements = array( 'd' => 4, ); } $stime=microtime(true); for ($i=1;$i<=100000;$i++){ $me = new Me(); $me->mergeElements(); } $etime=microtime(true); echo $etime-$stime;

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.0100.12016.59
7.3.00.0030.11816.88
7.2.130.0070.13416.96
7.2.120.0100.13517.00
7.2.110.0130.13516.98
7.2.100.0130.13417.07
7.2.90.0130.12916.95
7.2.80.0030.17816.96
7.2.70.0030.13716.84
7.2.60.0030.16516.96
7.2.50.0070.16616.61
7.2.40.0070.16016.89
7.2.30.0130.13616.68
7.2.20.0130.14016.76
7.2.10.0100.13116.96
7.2.00.0050.12217.97
7.1.250.0130.17515.76
7.1.240.0070.17615.88
7.1.230.0130.17515.56
7.1.220.0100.17515.78
7.1.210.0200.16815.84
7.1.200.0130.18715.92
7.1.190.0070.17715.93
7.1.180.0100.18415.77
7.1.170.0100.18215.46
7.1.160.0100.17615.47
7.1.150.0100.17915.75
7.1.140.0100.18915.93
7.1.130.0160.16815.65
7.1.120.0100.17415.74
7.1.110.0070.18015.68
7.1.100.0070.17916.06
7.1.90.0100.17215.92
7.1.80.0030.17715.76
7.1.70.0050.13516.60
7.1.60.0130.16117.75
7.1.50.0050.15416.40
7.1.40.0070.17515.99
7.1.30.0160.16915.80
7.1.20.0070.17715.89
7.1.10.0130.16715.44
7.1.00.0100.18619.04
7.0.330.0100.16915.49
7.0.320.0100.17115.39
7.0.310.0070.18215.20
7.0.300.0070.18915.42
7.0.290.0100.17215.19
7.0.280.0130.18015.02
7.0.270.0100.17314.95
7.0.260.0030.18215.28
7.0.250.0070.18415.28
7.0.240.0170.17015.37
7.0.230.0130.16915.42
7.0.220.0070.18515.11
7.0.210.0070.16815.18
7.0.200.0100.14016.07
7.0.190.0100.17415.35
7.0.180.0100.17215.25
7.0.170.0130.17815.45
7.0.160.0100.17315.45
7.0.150.0070.16915.12
7.0.140.0030.18118.53
7.0.130.0130.16115.27
7.0.120.0100.17015.64
7.0.110.0100.17615.52
7.0.100.0030.17515.55
7.0.90.0100.19215.38
7.0.80.0100.17315.18
7.0.70.0030.17215.43
7.0.60.0080.16517.66
7.0.50.0030.17416.56
7.0.40.0050.15616.67
7.0.30.0100.17516.85
7.0.20.0170.16516.71
7.0.10.0080.18116.80
7.0.00.0070.18416.78
5.6.380.0070.29214.48
5.6.370.0130.29213.95
5.6.360.0000.31513.90
5.6.350.0030.29514.55
5.6.340.0130.28814.42
5.6.330.0100.30614.32
5.6.320.0030.29614.51
5.6.310.0030.28214.35
5.6.300.0100.28114.30
5.6.290.0000.29814.19
5.6.280.0020.29217.57
5.6.270.0070.28014.24
5.6.260.0000.29214.36
5.6.250.0100.29114.43
5.6.240.0070.29214.18
5.6.230.0070.28314.35
5.6.220.0030.28914.13
5.6.210.0100.27917.26
5.6.200.0020.25216.28
5.6.190.0070.27217.41
5.6.180.0130.25517.49
5.6.170.0230.27517.45
5.6.160.0050.24117.39
5.6.150.0030.28716.29
5.6.140.0080.26416.09
5.6.130.0070.27716.27
5.6.120.0050.25817.70
5.6.110.0030.25717.68
5.6.100.0020.25917.56
5.6.90.0000.27717.63
5.6.80.0080.25217.21
5.6.70.2080.23617.12
5.6.60.0100.29713.93
5.6.50.0000.29214.23
5.6.40.0130.27113.97
5.6.30.0130.27414.05
5.6.20.0030.30514.05
5.6.10.0000.30114.36
5.6.00.0070.29914.09
5.5.380.0070.28310.87
5.5.370.0030.29711.28
5.5.360.0070.29011.25
5.5.350.0020.28315.69
5.5.340.0070.28014.59
5.5.330.0030.28515.71
5.5.320.0150.25815.77
5.5.310.0130.28815.71
5.5.300.0050.27314.63
5.5.290.0100.28314.70
5.5.280.0030.28316.14
5.5.270.0050.27716.13
5.5.260.0150.28015.99
5.5.250.0050.29315.71
5.5.240.0120.27415.77
5.5.230.0030.29410.83
5.5.220.0030.30111.16
5.5.210.0030.30711.07
5.5.200.0030.30611.04
5.5.190.0070.28410.96
5.5.180.0100.29011.20
5.5.170.0030.30310.84
5.5.160.0100.29410.90
5.5.150.0030.31211.07
5.5.140.0000.29410.93
5.5.130.0030.28411.03
5.5.120.0100.29410.82
5.5.110.0100.30510.96
5.5.100.0100.28111.26
5.5.90.0130.28511.27
5.5.80.0100.29410.95
5.5.70.0030.28911.01
5.5.60.0000.31610.80
5.5.50.0030.34911.18
5.5.40.0100.34911.04
5.5.30.0030.34911.04
5.5.20.0030.38411.14
5.5.10.0030.33711.19
5.5.00.0030.38810.85
5.4.450.0500.40515.23
5.4.440.0180.38315.14
5.4.430.0200.41115.23
5.4.420.0150.37215.26
5.4.410.0120.39714.89
5.4.400.0520.39614.91
5.4.390.0070.39614.74
5.4.380.0130.37914.79
5.4.370.0070.33214.70
5.4.360.0050.32714.97
5.4.350.0060.32911.63
5.4.340.0100.33411.53
5.4.330.0130.36411.03
5.4.320.0100.32911.68
5.4.310.0050.32111.84
5.4.300.0110.33111.63
5.4.290.0040.32111.85
5.4.280.0070.32911.78
5.4.270.0100.36611.63
5.4.260.0090.36411.59
5.4.250.0070.43511.62
5.4.240.0060.36711.71
5.4.230.0070.35111.55
5.4.220.0050.41711.69
5.4.210.0070.37511.74
5.4.200.0090.36011.72
5.4.190.0090.34311.65
5.4.180.0120.43011.76
5.4.170.0060.35411.71
5.4.160.0060.37011.80
5.4.150.0040.35811.70
5.4.140.0080.40111.57
5.4.130.0050.35111.54
5.4.120.0050.38411.57
5.4.110.0070.38311.62
5.4.100.0040.39811.45
5.4.90.0060.38811.49
5.4.80.0080.36111.49
5.4.70.0050.33411.59
5.4.60.0100.40411.55
5.4.50.0050.37911.63
5.4.40.0040.34211.47
5.4.30.0050.33211.52
5.4.20.0060.35111.54
5.4.10.0050.32511.54
5.4.00.0040.36811.22
5.3.290.0050.40811.57
5.3.280.0050.44911.63
5.3.270.0080.43111.60
5.3.260.0090.55011.72
5.3.250.0060.46011.55
5.3.240.0100.45111.63
5.3.230.0080.43411.63
5.3.220.0040.44111.62
5.3.210.0020.45611.46
5.3.200.0020.42911.58
5.3.190.0060.43911.46
5.3.180.0080.44711.67
5.3.170.0040.41911.57
5.3.160.0050.43411.49
5.3.150.0070.48811.56
5.3.140.0060.59111.50
5.3.130.0060.45211.45
5.3.120.0050.55611.60
5.3.110.0070.49011.63
5.3.100.0070.47511.33
5.3.90.0100.56811.35
5.3.80.0070.46311.13
5.3.70.0080.50411.23
5.3.60.0060.45411.38
5.3.50.0070.42811.27
5.3.40.0020.53311.28
5.3.30.0050.44411.29
5.3.20.0050.41411.10
5.3.10.0050.46710.97
5.3.00.0070.40811.00
5.2.170.0030.5099.46
5.2.160.0050.4759.42
5.2.150.0060.5069.39
5.2.140.0090.4859.37
5.2.130.0020.5399.30
5.2.120.0100.4969.34
5.2.110.0040.4949.35
5.2.100.0050.4859.28
5.2.90.0040.5809.33
5.2.80.0050.5389.27
5.2.70.0090.5609.27
5.2.60.0040.5029.25
5.2.50.0040.5069.23
5.2.40.0070.5759.24
5.2.30.0040.5369.21
5.2.20.0070.5479.20
5.2.10.0020.4749.17
5.2.00.0050.4819.10
5.1.60.0010.5178.74
5.1.50.0070.5458.74
5.1.40.0040.5758.73
5.1.30.0070.5898.91
5.1.20.0050.5878.92
5.1.10.0050.6898.78
5.1.00.0050.6948.78
5.0.50.0030.8248.02
5.0.40.0040.8017.95
5.0.30.0040.7137.85
5.0.20.0040.7237.84
5.0.10.0040.8027.83
5.0.00.0070.8147.83
4.4.90.0050.0087.09
4.4.80.0020.0137.08
4.4.70.0020.0117.07
4.4.60.0020.0107.08
4.4.50.0050.0087.08
4.4.40.0020.0187.05
4.4.30.0020.0117.08
4.4.20.0050.0097.12
4.4.10.0010.0127.12
4.4.00.0030.0187.08
4.3.110.0020.0127.04
4.3.100.0040.0097.03
4.3.90.0020.0137.02
4.3.80.0020.0136.99
4.3.70.0020.0117.01
4.3.60.0020.0117.01
4.3.50.0020.0177.01
4.3.40.0040.0206.97
4.3.30.0030.0136.34
4.3.20.0020.0126.33
4.3.10.0040.0086.31
4.3.00.0030.00811.31

preferences:
39.4 ms | 401 KiB | 5 Q