3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Arrayable { public function toArray(); } class Item implements Arrayable { protected $attributes = array(); protected $someParameter = true; public function __construct($attributes) { $this->attributes = $attributes; } public function toArray() { return $this->attributes; } } class ItemCollection implements Arrayable { protected $items = array(); public function addItem(Item $item) { $this->items[] = $item; } public function toArray() { $result = array(); foreach ($this->items as $item) { $result[] = $item->toArray(); } return $result; } } $array = array('foo' => 'bar', 'baz' => 'qux'); $item = new Item($array); print_r((array) $item); print_r($item->toArray()); $collection = new ItemCollection(); $collection->addItem($item); $collection->addItem($item); print_r((array) $collection); print_r($collection->toArray());

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)
8.3.60.0090.00618.31
8.3.50.0110.00722.00
8.3.40.0090.00618.79
8.3.30.0140.00319.05
8.3.20.0070.00020.29
8.3.10.0040.00423.54
8.3.00.0050.00319.38
8.2.180.0140.00016.36
8.2.170.0030.01722.96
8.2.160.0130.00020.35
8.2.150.0140.00024.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0000.00722.18
8.2.110.0070.00320.44
8.2.100.0060.00617.75
8.2.90.0040.00419.05
8.2.80.0050.00317.97
8.2.70.0080.00017.48
8.2.60.0030.00617.93
8.2.50.0040.00418.07
8.2.40.0060.00319.90
8.2.30.0070.00018.07
8.2.20.0000.00817.82
8.2.10.0000.00718.03
8.2.00.0000.00817.70
8.1.280.0100.01025.92
8.1.270.0080.00023.66
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0060.00320.95
8.1.230.0110.00019.04
8.1.220.0060.00317.78
8.1.210.0040.00418.77
8.1.200.0060.00617.25
8.1.190.0070.00317.35
8.1.180.0050.00318.10
8.1.170.0040.00420.30
8.1.160.0000.00822.03
8.1.150.0000.00718.96
8.1.140.0000.00717.45
8.1.130.0000.00817.77
8.1.120.0040.00417.51
8.1.110.0040.00417.42
8.1.100.0030.00317.37
8.1.90.0000.00817.50
8.1.80.0000.00717.45
8.1.70.0000.00717.42
8.1.60.0050.00617.63
8.1.50.0030.00617.54
8.1.40.0020.00517.54
8.1.30.0060.00317.64
8.1.20.0000.00717.66
8.1.10.0000.00817.39
8.1.00.0050.00317.48
8.0.300.0030.00618.77
8.0.290.0000.00716.63
8.0.280.0070.00018.50
8.0.270.0070.00017.19
8.0.260.0060.00017.33
8.0.250.0070.00016.95
8.0.240.0070.00016.91
8.0.230.0000.00716.99
8.0.220.0050.00216.91
8.0.210.0000.00616.93
8.0.200.0070.00016.90
8.0.190.0000.00717.02
8.0.180.0030.00516.89
8.0.170.0000.00717.04
8.0.160.0000.00717.01
8.0.150.0070.00016.88
8.0.140.0000.00816.83
8.0.130.0030.00313.38
8.0.120.0040.00416.91
8.0.110.0070.00016.98
8.0.100.0060.00317.09
8.0.90.0070.00016.96
8.0.80.0110.00816.94
8.0.70.0070.00016.93
8.0.60.0040.00416.84
8.0.50.0030.00616.91
8.0.30.0120.00917.10
8.0.20.0090.01417.40
8.0.10.0040.00416.98
8.0.00.0100.00916.75
7.4.330.0050.00315.02
7.4.320.0030.00316.45
7.4.300.0000.00616.57
7.4.290.0000.00816.54
7.4.280.0000.00816.48
7.4.270.0040.00416.54
7.4.260.0000.00716.53
7.4.250.0030.00616.61
7.4.240.0070.00016.63
7.4.230.0000.00716.64
7.4.220.0110.00716.54
7.4.210.0100.00616.63
7.4.200.0050.00316.59
7.4.160.0100.00516.46
7.4.150.0070.01117.40
7.4.140.0120.00817.86
7.4.130.0110.00616.44
7.4.120.0090.00816.46
7.4.110.0120.00616.50
7.4.100.0070.01016.57
7.4.90.0120.00616.54
7.4.80.0100.00719.39
7.4.70.0100.01016.39
7.4.60.0100.00716.52
7.4.50.0030.00616.35
7.4.40.0130.00616.55
7.4.30.0120.00916.73
7.4.00.0040.01415.15
7.3.330.0000.00513.36
7.3.320.0000.00513.28
7.3.310.0030.00316.31
7.3.300.0030.00316.21
7.3.290.0080.00616.30
7.3.280.0080.00816.34
7.3.270.0130.00617.40
7.3.260.0060.01316.34
7.3.250.0030.01416.55
7.3.240.0090.00916.26
7.3.230.0060.01316.39
7.3.210.0120.00416.50
7.3.200.0080.01119.39
7.3.190.0060.01616.67
7.3.180.0100.00716.34
7.3.170.0110.00616.49
7.3.160.0000.01716.35
7.2.330.0190.00016.69
7.2.320.0040.01216.86
7.2.310.0060.01016.86
7.2.300.0100.00616.77
7.2.290.0140.01016.60
7.2.60.0110.00716.64
7.1.200.0090.00615.81
7.1.70.0030.00517.10
7.1.60.0070.01719.32
7.1.50.0000.01716.92
7.1.00.0000.08022.51
7.0.200.0000.00816.46
7.0.140.0000.07022.07
7.0.110.0000.05721.79
7.0.100.0030.05721.81
7.0.90.0070.03721.75
7.0.80.0030.04021.77
7.0.70.0030.04321.70
7.0.60.0000.05021.80
7.0.50.0000.05321.89
7.0.40.0000.03719.72
7.0.30.0000.04319.79
7.0.20.0000.04019.82
7.0.10.0000.04319.75
7.0.00.0000.04319.72
5.6.280.0070.07320.90
5.6.260.0000.05720.61
5.6.250.0000.07320.89
5.6.240.0000.04020.73
5.6.230.0000.04020.57
5.6.220.0030.05020.69
5.6.210.0030.04020.56
5.6.200.0000.04320.60
5.6.190.0070.03720.58
5.6.180.0070.07720.57
5.6.170.0000.04020.67
5.6.160.0030.03720.60
5.6.150.0000.04320.63
5.6.140.0100.05720.66
5.6.130.0070.05020.70
5.6.120.0070.03320.62
5.6.110.0000.04320.62
5.6.100.0070.07320.69
5.6.90.0000.08720.46
5.6.80.0130.07020.10
5.6.70.0000.08020.08
5.6.60.0070.06320.07
5.6.50.0100.07020.05
5.6.40.0030.05019.84
5.6.30.0070.07320.01
5.6.20.0170.07319.84
5.6.10.0000.07719.96
5.6.00.0070.07019.97
5.5.380.0000.03717.52
5.5.370.0030.05017.70
5.5.360.0100.03317.60
5.5.350.0030.04017.66
5.5.340.0000.03718.25
5.5.330.0100.03017.91
5.5.320.0000.04017.91
5.5.310.0070.05718.22
5.5.300.0030.04018.09
5.5.290.0000.04018.13
5.5.280.0000.05018.13
5.5.270.0030.04718.08
5.5.260.0030.07018.25
5.5.250.0070.07717.94
5.5.240.0030.07717.34
5.5.230.0000.08017.50
5.5.220.0100.06717.60
5.5.210.0070.07317.48
5.5.200.0030.07017.44
5.5.190.0070.07317.44
5.5.180.0100.07317.45
5.5.160.0030.05717.45
5.5.150.0030.04317.57
5.5.140.0000.08017.27
5.5.130.0070.06317.44
5.5.120.0000.08317.44
5.5.110.0030.08017.48
5.5.100.0070.07717.38
5.5.90.0070.07317.47
5.5.80.0070.06717.32
5.5.70.0030.08317.17
5.5.60.0130.06717.47
5.5.50.0000.04317.46
5.5.40.0130.07017.17
5.5.30.0030.08017.38
5.5.20.0070.07017.14
5.5.10.0100.06317.32
5.5.00.0030.07717.33
5.4.450.0000.03719.52
5.4.440.0000.05019.55
5.4.430.0100.06719.31
5.4.420.0070.08019.65
5.4.410.0030.04719.34
5.4.400.0070.07319.34
5.4.390.0100.07019.03
5.4.380.0070.07019.00
5.4.370.0030.05319.34
5.4.360.0000.08319.01
5.4.350.0000.07719.09
5.4.340.0030.06718.99
5.4.320.0130.06319.00
5.4.310.0130.05719.01
5.4.300.0130.06319.09
5.4.290.0070.07018.98
5.4.280.0030.05318.98
5.4.270.0000.07019.03
5.4.260.0100.06018.98
5.4.250.0000.04718.99
5.4.240.0030.07019.18
5.4.230.0070.07318.94
5.4.220.0000.07719.03
5.4.210.0070.07019.19
5.4.200.0130.06719.08
5.4.190.0000.04719.00
5.4.180.0130.03718.97
5.4.170.0030.07719.15
5.4.160.0130.03719.32
5.4.150.0030.08018.99
5.4.140.0030.07316.43
5.4.130.0030.07016.61
5.4.120.0030.06716.67
5.4.110.0070.07316.67
5.4.100.0070.07016.62
5.4.90.0030.07316.63
5.4.80.0000.07716.30
5.4.70.0000.06316.50
5.4.60.0030.06716.57
5.4.50.0070.07016.33
5.4.40.0070.07016.53
5.4.30.0000.05716.54
5.4.20.0030.04016.52
5.4.10.0070.06016.53
5.4.00.0070.06715.77
5.3.290.0100.07314.67
5.3.280.0100.07014.61
5.3.270.0100.06314.74
5.3.260.0030.07714.76
5.3.250.0000.07014.75
5.3.240.0000.07714.63
5.3.230.0030.06714.68
5.3.220.0070.07314.80
5.3.210.0030.07714.55
5.3.200.0030.07314.58
5.3.190.0030.07014.59
5.3.180.0000.07014.67
5.3.170.0030.07014.70
5.3.160.0030.06314.60
5.3.150.0030.07314.58
5.3.140.0070.04314.52
5.3.130.0000.07714.70
5.3.120.0070.07014.57
5.3.110.0070.07714.64
5.3.100.0030.04714.17
5.3.90.0030.06714.26
5.3.80.0030.07014.05
5.3.70.0000.08014.05
5.3.60.0000.06713.87
5.3.50.0000.07314.02
5.3.40.0030.07313.95
5.3.30.0000.07713.92
5.3.20.0000.08013.71
5.3.10.0030.06713.72
5.3.00.0000.07313.68
5.2.170.0030.06311.17
5.2.160.0030.06011.22
5.2.150.0100.06011.30
5.2.140.0070.04311.15
5.2.130.0070.05711.13
5.2.120.0000.06311.20
5.2.110.0030.06311.07
5.2.100.0030.06311.21
5.2.90.0030.05011.08
5.2.80.0030.06311.08
5.2.70.0030.04311.12
5.2.60.0030.06011.03
5.2.50.0070.05311.12
5.2.40.0100.05311.23
5.2.30.0030.05711.21
5.2.20.0030.05710.94
5.2.10.0100.02710.95
5.2.00.0000.06310.85
5.1.60.0070.02710.16
5.1.50.0030.05310.09
5.1.40.0000.0509.95
5.1.30.0030.04710.58
5.1.20.0000.06010.38
5.1.10.0070.05010.07
5.1.00.0070.05010.11
5.0.50.0030.0479.76
5.0.40.0070.0409.76
5.0.30.0030.0509.76
5.0.20.0000.0379.76
5.0.10.0030.0339.76
5.0.00.0000.0379.76
4.4.90.0030.0309.76
4.4.80.0030.0309.76
4.4.70.0000.0379.76
4.4.60.0030.0309.76
4.4.50.0000.0379.76
4.4.40.0030.0479.76
4.4.30.0030.0309.76
4.4.20.0000.0339.76
4.4.10.0000.0339.76
4.4.00.0070.0539.76
4.3.110.0030.0309.76
4.3.100.0030.0239.76
4.3.90.0030.0179.76
4.3.80.0000.0509.76
4.3.70.0030.0239.76
4.3.60.0030.0239.76
4.3.50.0000.0179.76
4.3.40.0000.0439.76
4.3.30.0030.0139.76
4.3.20.0000.0379.76
4.3.10.0000.0379.76
4.3.00.0070.0309.76

preferences:
35.17 ms | 401 KiB | 5 Q