3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Collection { public $fixedArray; public function __construct(SplFixedArray $splFixedArray) { $this->fixedArray = $splFixedArray; } public function getSum() { $sum = 0; $arr = $this->fixedArray; foreach ($arr as $item) { $sum += $item; } return $sum; } } $spl = SplFixedArray::fromArray([0, 1, 2]); $collection = new Collection($spl); $collArr = $collection->fixedArray; $i = 0; foreach ($collArr as $item) { echo '-- iteration: ' . $i . ', sum: ' . $collection->getSum() . PHP_EOL; $i++; } echo 'Expected 3 iterations, executed ' . $i . PHP_EOL;

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.70.0100.01016.63
8.3.60.0000.01516.63
8.3.50.0140.00318.15
8.3.40.0080.01220.47
8.3.30.0160.00318.55
8.3.20.0000.00821.65
8.3.10.0000.00822.08
8.3.00.0080.00020.57
8.2.180.0090.00618.16
8.2.170.0180.00422.96
8.2.160.0070.00720.91
8.2.150.0030.00724.18
8.2.140.0000.00824.66
8.2.130.0030.00526.16
8.2.120.0060.00321.10
8.2.110.0000.00921.13
8.2.100.0080.00417.82
8.2.90.0000.00817.97
8.2.80.0060.00318.16
8.2.70.0040.00417.50
8.2.60.0030.00618.04
8.2.50.0050.00318.07
8.2.40.0040.00418.22
8.2.30.0070.00018.14
8.2.20.0000.00718.14
8.2.10.0040.00419.34
8.2.00.0030.00519.34
8.1.280.0130.01025.92
8.1.270.0040.00423.99
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0060.00321.99
8.1.230.0090.00320.96
8.1.220.0000.00817.76
8.1.210.0030.00518.77
8.1.200.0060.00317.35
8.1.190.0050.00317.23
8.1.180.0030.00718.10
8.1.170.0000.00918.59
8.1.160.0040.00418.89
8.1.150.0030.00518.90
8.1.140.0040.00418.90
8.1.130.0090.00020.12
8.1.120.0000.00717.31
8.1.110.0000.00717.49
8.1.100.0040.00417.44
8.1.90.0040.00417.38
8.1.80.0000.00817.39
8.1.70.0030.00317.52
8.1.60.0040.00417.61
8.1.50.0050.00317.43
8.1.40.0060.00317.58
8.1.30.0060.00617.65
8.1.20.0060.00317.66
8.1.10.0050.00317.57
8.1.00.0090.00017.49
8.0.300.0040.00419.97
8.0.290.0040.00416.75
8.0.280.0050.00318.40
8.0.270.0080.00018.05
8.0.260.0000.01019.95
8.0.250.0030.00317.05
8.0.240.0070.00017.03
8.0.230.0030.00317.04
8.0.220.0030.00616.89
8.0.210.0030.00417.02
8.0.200.0030.00317.01
8.0.190.0040.00416.99
8.0.180.0040.00416.87
8.0.170.0030.01016.97
8.0.160.0000.00717.02
8.0.150.0040.00316.86
8.0.140.0040.00416.89
8.0.130.0030.00313.43
8.0.120.0060.00316.96
8.0.110.0000.00816.82
8.0.100.0070.00016.84
8.0.90.0060.00316.95
8.0.80.0100.00616.96
8.0.70.0040.00416.79
8.0.60.0030.00416.86
8.0.50.0000.00816.84
8.0.30.0070.01017.16
8.0.20.0100.00917.21
8.0.10.0030.00517.14
8.0.00.0100.01416.74
7.4.330.0050.00015.55
7.4.320.0070.00016.54
7.4.300.0000.00616.52
7.4.290.0040.00416.43
7.4.280.0070.00016.59
7.4.270.0030.00316.52
7.4.260.0030.00313.21
7.4.250.0030.00316.59
7.4.240.0030.00316.56
7.4.230.0000.00716.64
7.4.220.0040.00316.54
7.4.210.0080.00916.58
7.4.200.0000.00816.43
7.4.130.0080.00916.58
7.4.120.0070.01016.43
7.4.110.0170.00816.74
7.4.100.0090.01216.69
7.4.90.0060.01216.42
7.4.80.0110.00719.39
7.4.70.0060.01016.48
7.4.60.0130.00316.35
7.4.50.0000.01716.57
7.4.40.0060.01016.52
7.4.30.0080.00816.49
7.4.20.0090.00716.46
7.4.10.0110.00616.43
7.4.00.0090.00716.54
7.3.330.0040.00416.23
7.3.320.0000.00613.37
7.3.310.0000.00716.40
7.3.300.0030.00316.38
7.3.290.0050.01216.38
7.3.260.0090.01416.61
7.3.240.0100.00816.46
7.3.230.0120.00616.43
7.3.210.0120.00616.42
7.3.200.0140.00516.52
7.3.190.0030.01316.43
7.3.180.0000.01616.36
7.3.170.0080.00816.52
7.3.160.0090.00616.41
7.3.150.0080.00816.36
7.3.140.0060.01016.41
7.3.130.0110.00616.42
7.3.120.0110.00616.49
7.3.110.0080.00916.43
7.3.100.0080.00816.37
7.3.90.0080.00816.35
7.3.80.0100.00616.38
7.3.70.0090.00816.41
7.3.60.0070.01016.38
7.3.50.0050.01216.36
7.3.40.0080.00816.45
7.3.30.0080.01116.42
7.3.20.0070.00816.37
7.3.10.0090.00816.40
7.3.00.0120.00616.46
7.2.330.0100.01016.70
7.2.320.0070.01116.75
7.2.310.0100.00716.57
7.2.300.0100.00716.48
7.2.290.0080.00916.58
7.2.280.0040.01216.79
7.2.270.0060.01016.71
7.2.260.0110.00616.68
7.2.250.0100.00816.79
7.2.240.0060.01016.60
7.2.230.0060.01116.75
7.2.220.0060.01116.68
7.2.210.0090.00716.50
7.2.200.0070.01016.59
7.2.190.0050.01016.59
7.2.180.0070.00916.65
7.2.170.0090.01116.59
7.2.160.0070.00916.71
7.2.150.0150.00616.71
7.2.140.0090.00816.66
7.2.130.0080.00916.68
7.2.120.0090.00916.68
7.2.110.0090.00816.70
7.2.100.0180.00516.75
7.2.90.0080.01116.72
7.2.80.0090.01116.62
7.2.70.0120.01016.64
7.2.60.0270.01116.67
7.2.50.0050.01516.74
7.2.40.0110.01216.69
7.2.30.0120.00816.75
7.2.20.0150.00516.55
7.2.10.0080.01116.74
7.2.00.0070.01116.62
7.1.330.0040.01515.60
7.1.320.0050.01315.66
7.1.310.0170.01415.62
7.1.300.0080.00815.55
7.1.290.0080.00815.65
7.1.280.0070.01015.54
7.1.270.0070.01015.50
7.1.260.0140.00415.63
7.1.250.0130.00515.51
7.1.240.0100.00815.46
7.1.230.0050.01315.36
7.1.220.0040.01415.50
7.1.210.0150.00615.59
7.1.200.0130.00515.61
7.1.190.0130.00715.51
7.1.180.0100.01015.45
7.1.170.0050.01315.47
7.1.160.0150.00915.54
7.1.150.0160.00615.57
7.1.140.0160.00715.32
7.1.130.0140.00315.50
7.1.120.0110.00715.62
7.1.110.0060.01115.62
7.1.100.0080.00815.37
7.1.90.0100.00715.52
7.1.80.0110.01015.56
7.1.70.0100.01115.54
7.1.60.0100.00915.59
7.1.50.0150.00815.38
7.1.40.0130.00515.46
7.1.30.0070.01215.55
7.1.20.0210.00315.66
7.1.10.0140.00315.29
7.1.00.0070.00915.59
7.0.330.0090.00915.25
7.0.320.0120.00815.10
7.0.310.0130.00715.19
7.0.300.0110.00715.17
7.0.290.0100.01215.03
7.0.280.0120.00715.29
7.0.270.0090.00715.15
7.0.260.0100.00615.21
7.0.250.0130.00315.18
7.0.240.0190.00415.24
7.0.230.0150.00615.19
7.0.220.0090.00915.24
7.0.210.0110.01115.19
7.0.200.0110.00515.20
7.0.190.0020.01415.31
7.0.180.0090.00615.14
7.0.170.0120.00515.23
7.0.160.0100.00915.28
7.0.150.0120.00515.34
7.0.140.0100.00815.26
7.0.130.0120.00515.25
7.0.120.0220.00415.24
7.0.110.0060.00915.29
7.0.100.0090.00715.32
7.0.90.0100.00815.25
7.0.80.0100.00915.29
7.0.70.0120.00615.31
7.0.60.0090.01015.15
7.0.50.0160.00515.20
7.0.40.0120.00615.23
7.0.30.0100.01015.24
7.0.20.0150.00515.09
7.0.10.0080.01015.23
7.0.00.0120.00815.24
5.6.400.0080.01115.88
5.6.390.0120.01015.92
5.6.380.0080.01216.05
5.6.370.0140.00915.96
5.6.360.0100.01016.13
5.6.350.0100.01315.88
5.6.340.0110.00816.21
5.6.330.0090.01016.06
5.6.320.0070.01215.98
5.6.310.0130.00615.92
5.6.300.0080.01216.05
5.6.290.0150.00516.01
5.6.280.0100.00916.13
5.6.270.0040.01516.06
5.6.260.0110.00816.03
5.6.250.0060.01416.09
5.6.240.0110.00815.90
5.6.230.0110.00816.09
5.6.220.0070.01316.06
5.6.210.0050.01515.93
5.6.200.0130.00916.02
5.6.190.0110.01015.91
5.6.180.0130.01016.00
5.6.170.0160.00816.12
5.6.160.0100.01115.91
5.6.150.0130.00816.14
5.6.140.0150.00515.88
5.6.130.0140.00916.10
5.6.120.0110.01115.87
5.6.110.0070.01315.92
5.6.100.0150.00816.10
5.6.90.0070.01416.01
5.6.80.0100.01015.82
5.6.70.0080.01115.93
5.6.60.0100.00915.87
5.6.50.0100.01016.01
5.6.40.0130.01015.66
5.6.30.0090.01415.51
5.6.20.0100.01215.90
5.6.10.0120.01115.82
5.6.00.0120.01415.64
5.5.380.0140.01216.09
5.5.370.0140.01015.86
5.5.360.0120.01515.80
5.5.350.0160.01415.87
5.5.340.0150.01115.92
5.5.330.0150.01115.77
5.5.320.0200.00915.85
5.5.310.0200.00915.87
5.5.300.0170.00815.81
5.5.290.0150.01015.97
5.5.280.0140.01015.90
5.5.270.0150.01115.82
5.5.260.0140.01315.79
5.5.250.0140.01115.81
5.5.240.0190.00615.71
5.5.230.0180.00715.69
5.5.220.0160.01015.73
5.5.210.0150.01015.81
5.5.200.0170.00915.82
5.5.190.0130.01215.75
5.5.180.0140.01515.64
5.5.170.0150.01115.64
5.5.160.0150.01415.87
5.5.150.0190.00715.90
5.5.140.0120.01415.80
5.5.130.0150.01115.88
5.5.120.0150.01115.92
5.5.110.0180.00615.82
5.5.100.0140.01215.72
5.5.90.0170.00815.73
5.5.80.0140.01115.67
5.5.70.0180.00715.87
5.5.60.0160.01315.69
5.5.50.0160.01115.87
5.5.40.0150.01215.64
5.5.30.0180.01015.82
5.5.20.0190.00615.81
5.5.10.0110.01615.76
5.5.00.0150.01115.71
5.4.450.0140.00812.54
5.4.440.0100.00712.74
5.4.430.0130.00612.76
5.4.420.0110.00812.66
5.4.410.0110.00912.63
5.4.400.0150.00412.75
5.4.390.0130.00712.66
5.4.380.0150.00512.63
5.4.370.0140.00512.73
5.4.360.0110.01012.79
5.4.350.0110.00812.66
5.4.340.0150.00612.70
5.4.330.0100.01112.69
5.4.320.0140.00612.65
5.4.310.0130.00712.58
5.4.300.0130.00712.48
5.4.290.0120.00812.66
5.4.280.0150.00512.75
5.4.270.0110.01012.75
5.4.260.0140.00612.65
5.4.250.0170.00412.58
5.4.240.0120.00712.66
5.4.230.0160.00412.74
5.4.220.0120.00912.64
5.4.210.0110.00912.59
5.4.200.0160.00512.74
5.4.190.0160.00512.58
5.4.180.0140.00612.72
5.4.170.0110.00912.74
5.4.160.0170.00512.59
5.4.150.0140.00812.75
5.4.140.0180.00512.76
5.4.130.0130.00712.82
5.4.120.0120.00712.63
5.4.110.0110.00912.63
5.4.100.0090.00912.64
5.4.90.0130.00712.67
5.4.80.0130.00812.71
5.4.70.0150.00512.72
5.4.60.0130.00612.70
5.4.50.0100.00912.73
5.4.40.0110.00812.55
5.4.30.0130.00512.71
5.4.20.0140.00612.82
5.4.10.0140.00712.82
5.4.00.0120.00812.63
5.3.290.0090.01512.83
5.3.280.0150.00712.81
5.3.270.0170.00712.89
5.3.260.0150.01012.85
5.3.250.0180.00712.79
5.3.240.0160.00812.68
5.3.230.0110.01012.80
5.3.220.0090.01512.69
5.3.210.0180.00912.87
5.3.200.0120.00812.73
5.3.190.0150.00912.73
5.3.180.0190.00612.89
5.3.170.0220.00212.96
5.3.160.0120.01012.91
5.3.150.0180.00412.95
5.3.140.0150.00712.79
5.3.130.0150.00712.82
5.3.120.0120.00812.86
5.3.110.0130.00912.81
5.3.100.0140.00312.87
5.3.90.0050.01212.94
5.3.80.0120.00712.74
5.3.70.0120.00912.79
5.3.60.0070.01112.84
5.3.50.0080.00912.71
5.3.40.0150.00412.79
5.3.30.0110.01012.76
5.3.20.0130.00812.87
5.3.10.0070.01212.63
5.3.00.0120.00612.63
5.2.170.0120.00712.02
5.2.160.0120.00911.87
5.2.150.0130.00611.79
5.2.140.0100.01211.87
5.2.130.0100.00911.78
5.2.120.0130.00511.89
5.2.110.0150.00711.92
5.2.100.0120.00911.72
5.2.90.0120.00911.85
5.2.80.0140.00511.74
5.2.70.0170.00511.73
5.2.60.0100.00911.72
5.2.50.0130.00711.85
5.2.40.0150.00511.89
5.2.30.0170.00411.78
5.2.20.0160.00311.69
5.2.10.0110.00711.66
5.2.00.0100.00911.58
5.1.60.0100.00511.26
5.1.50.0070.00911.26
5.1.40.0110.00511.42
5.1.30.0110.00611.33
5.1.20.0110.00611.31
5.1.10.0130.00511.38
5.1.00.0120.00511.19
5.0.50.0130.00111.14
5.0.40.0090.00411.14
5.0.30.0080.00611.14
5.0.20.0070.00711.14
5.0.10.0110.00311.14
5.0.00.0080.00711.14
4.4.90.0070.00211.14
4.4.80.0070.00211.14
4.4.70.0040.00611.14
4.4.60.0060.00211.14
4.4.50.0060.00211.14
4.4.40.0040.00411.14
4.4.30.0070.00111.14
4.4.20.0060.00311.14
4.4.10.0090.00111.14
4.4.00.0010.00711.14
4.3.110.0030.00511.14
4.3.100.0070.00111.14
4.3.90.0060.00311.14
4.3.80.0090.00211.14
4.3.70.0060.00411.14
4.3.60.0080.00311.14
4.3.50.0060.00411.14
4.3.40.0050.00411.14
4.3.30.0020.00711.14
4.3.20.0040.00411.14
4.3.10.0020.00611.14
4.3.00.0050.00211.14

preferences:
61.12 ms | 401 KiB | 5 Q