3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array("Item1.10", "Item2.5", "Item3.0", "Item2.2", "Item4.50", "Item2.50"); $tempArray = array(); $newArray = array(); foreach($array as $value) { $item = substr($value, 0, 5); if(!in_array($item, $tempArray)) { $newArray[] = $value; $tempArray[] = $item; } } print_r($newArray);

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.0160.00618.68
8.3.50.0150.00321.15
8.3.40.0040.01118.72
8.3.30.0100.00319.04
8.3.20.0120.00320.35
8.3.10.0040.00423.65
8.3.00.0060.00319.26
8.2.180.0120.00616.50
8.2.170.0070.00722.96
8.2.160.0100.00320.39
8.2.150.0040.00424.18
8.2.140.0110.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00421.99
8.2.110.0030.00622.18
8.2.100.0060.00617.78
8.2.90.0040.00417.78
8.2.80.0000.00817.97
8.2.70.0030.00617.50
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0000.00819.88
8.2.30.0000.00718.13
8.2.20.0030.00617.78
8.2.10.0000.00818.05
8.2.00.0000.00817.80
8.1.280.0140.00425.92
8.1.270.0080.00023.91
8.1.260.0040.00426.35
8.1.250.0020.00528.09
8.1.240.0000.00922.54
8.1.230.0040.00720.89
8.1.220.0070.00017.79
8.1.210.0040.00419.10
8.1.200.0000.00817.23
8.1.190.0040.00417.22
8.1.180.0060.00318.10
8.1.170.0000.00918.50
8.1.160.0000.00822.08
8.1.150.0000.00818.89
8.1.140.0040.00417.38
8.1.130.0070.00017.75
8.1.120.0000.00717.38
8.1.110.0000.00817.36
8.1.100.0050.00217.52
8.1.90.0000.00717.46
8.1.80.0040.00417.36
8.1.70.0030.00317.40
8.1.60.0030.00617.54
8.1.50.0030.00617.52
8.1.40.0030.00617.39
8.1.30.0000.00817.64
8.1.20.0070.00017.70
8.1.10.0060.00317.36
8.1.00.0080.00017.44
8.0.300.0080.00019.83
8.0.290.0030.00616.75
8.0.280.0050.00218.54
8.0.270.0070.00017.27
8.0.260.0040.00417.26
8.0.250.0030.00316.98
8.0.240.0000.00716.94
8.0.230.0050.00316.93
8.0.220.0050.00216.89
8.0.210.0070.00016.91
8.0.200.0030.00316.82
8.0.190.0000.00717.00
8.0.180.0040.00416.88
8.0.170.0040.00416.81
8.0.160.0000.00716.79
8.0.150.0020.00516.82
8.0.140.0070.00016.85
8.0.130.0050.00013.36
8.0.120.0000.00716.77
8.0.110.0080.00016.84
8.0.100.0000.00716.93
8.0.90.0000.00816.78
8.0.80.0120.00616.92
8.0.70.0080.00016.99
8.0.60.0070.00016.77
8.0.50.0000.00716.91
8.0.30.0090.01416.96
8.0.20.0070.01217.40
8.0.10.0070.00017.10
8.0.00.0100.00816.60
7.4.330.0000.00515.04
7.4.320.0030.00316.60
7.4.300.0060.00016.51
7.4.290.0030.00316.61
7.4.280.0040.00416.57
7.4.270.0030.00316.50
7.4.260.0050.00316.41
7.4.250.0040.00416.57
7.4.240.0030.00316.49
7.4.230.0030.00316.58
7.4.220.0130.01316.63
7.4.210.0090.00616.62
7.4.200.0080.00016.61
7.4.160.0090.00616.34
7.4.150.0120.00617.40
7.4.140.0170.00517.86
7.4.130.0120.00516.59
7.4.120.0050.01216.44
7.4.110.0100.00716.38
7.4.100.0140.00916.59
7.4.90.0140.00316.45
7.4.80.0040.01619.39
7.4.70.0040.01916.57
7.4.60.0090.00916.42
7.4.50.0040.00416.45
7.4.40.0060.01516.47
7.4.30.0070.01216.54
7.4.00.0050.01215.05
7.3.330.0000.00613.06
7.3.320.0000.00513.03
7.3.310.0000.00716.05
7.3.300.0070.00016.11
7.3.290.0090.00616.24
7.3.280.0080.00916.27
7.3.270.0120.00617.40
7.3.260.0160.00716.54
7.3.250.0080.01016.39
7.3.240.0130.00916.63
7.3.230.0080.00916.39
7.3.210.0090.00616.66
7.3.200.0090.00619.39
7.3.190.0070.01016.48
7.3.180.0130.00416.31
7.3.170.0090.01016.55
7.3.160.0100.00616.34
7.3.120.0070.01014.95
7.3.110.0040.01515.14
7.3.100.0000.01114.85
7.3.90.0060.01315.01
7.3.80.0070.00714.51
7.3.70.0030.01314.86
7.3.60.0040.01214.93
7.3.50.0070.00314.87
7.3.40.0030.01214.80
7.3.30.0060.00914.78
7.3.20.0100.00716.74
7.3.10.0100.00316.49
7.3.00.0070.01016.50
7.2.330.0120.00416.77
7.2.320.0100.00716.70
7.2.310.0120.00316.58
7.2.300.0140.00716.54
7.2.290.0150.00416.74
7.2.250.0080.00814.98
7.2.240.0160.00315.30
7.2.230.0060.01014.97
7.2.220.0040.01215.06
7.2.210.0090.00615.19
7.2.200.0070.00315.06
7.2.190.0030.00614.73
7.2.180.0040.01215.03
7.2.170.0120.00314.98
7.2.60.0040.01517.09
7.2.00.0000.01319.23
7.1.330.0040.00715.74
7.1.320.0090.00415.75
7.1.310.0060.00915.80
7.1.300.0100.00315.96
7.1.290.0030.00615.70
7.1.280.0090.00615.53
7.1.270.0070.01015.63
7.1.260.0070.00415.76
7.1.200.0060.00615.54
7.1.100.0000.01018.06
7.1.70.0030.00617.13
7.1.60.0130.01019.11
7.1.50.0140.01017.02
7.1.00.0070.06722.48
7.0.200.0000.00916.68
7.0.140.0000.07022.01
7.0.60.0130.08019.86
7.0.50.0130.07717.89
7.0.40.0100.08020.05
7.0.30.0300.06320.21
7.0.20.0370.07720.21
7.0.10.0300.08020.10
7.0.00.0000.05720.22
5.6.280.0100.06720.82
5.6.210.0030.04020.75
5.6.200.0070.05318.29
5.6.190.0070.08720.39
5.6.180.0370.07320.60
5.6.170.0170.04020.58
5.6.160.0100.08320.54
5.6.150.0170.07318.28
5.6.140.0000.04318.18
5.6.130.0030.04018.11
5.6.120.0100.06021.00
5.6.110.0030.08721.09
5.6.100.0200.05720.98
5.6.90.0100.06020.98
5.6.80.0130.05720.35
5.6.70.4470.04020.49
5.5.350.0170.02720.32
5.5.340.0070.08017.98
5.5.330.0100.08020.19
5.5.320.0270.04320.37
5.5.310.0270.04020.30
5.5.300.0070.04017.98
5.5.290.0000.04717.95
5.5.280.0130.06320.93
5.5.270.0100.05320.79
5.5.260.0030.05020.87
5.5.250.0100.04020.49
5.5.240.0370.07020.36
5.4.450.0100.06319.59
5.4.440.0200.05319.43
5.4.430.0170.05719.38
5.4.420.0630.00019.53
5.4.410.0600.00019.42
5.4.400.0600.00019.07
5.4.390.0630.00019.13
5.4.380.0630.00019.12
5.4.370.0600.00019.26
5.4.360.0630.00019.03
5.4.350.0630.00019.21
5.4.340.0090.03112.00
5.4.320.0060.03712.48
5.4.310.0080.03612.48
5.4.300.0040.04012.48
5.4.290.0080.03712.48
5.4.280.0030.04412.38
5.4.270.0070.03712.38
5.4.260.0050.03912.38
5.4.250.0070.03612.38
5.4.240.0090.03312.38
5.4.230.0060.04412.37
5.4.220.0040.03712.37
5.4.210.0090.03312.37
5.4.200.0080.03612.37
5.4.190.0090.03212.36
5.4.180.0090.03912.36
5.4.170.0050.04112.38
5.4.160.0020.03912.37
5.4.150.0060.03712.37
5.4.140.0120.03412.05
5.4.130.0070.04412.04
5.4.120.0060.03612.00
5.4.110.0060.03712.00
5.4.100.0080.03612.00
5.4.90.0080.03612.00
5.4.80.0090.03512.00
5.4.70.0080.03511.99
5.4.60.0070.03511.99
5.4.50.0050.03712.00
5.4.40.0060.03511.98
5.4.30.0030.03911.98
5.4.20.0060.03611.98
5.4.10.0050.03711.97
5.4.00.0090.03411.47
5.3.290.0100.03612.80
5.3.280.0040.04012.70
5.3.270.0050.04212.73
5.3.260.0110.03412.72
5.3.250.0090.03412.72
5.3.240.0040.03912.71
5.3.230.0060.03812.71
5.3.220.0070.03612.68
5.3.210.0090.05012.68
5.3.200.0080.03512.68
5.3.190.0060.04012.68
5.3.180.0100.04112.67
5.3.170.0100.03812.67
5.3.160.0060.04012.67
5.3.150.0040.04112.67
5.3.140.0080.03512.66
5.3.130.0080.04012.66
5.3.120.0090.03712.65
5.3.110.0060.03912.66
5.3.100.0090.03412.12
5.3.90.0060.03712.09
5.3.80.0050.03812.08
5.3.70.0070.03512.08
5.3.60.0170.03812.06
5.3.50.0110.04412.01
5.3.40.0100.04612.01
5.3.30.0080.03811.97
5.3.20.0070.03611.75
5.3.10.0080.03311.71
5.3.00.0050.03711.70
5.2.170.0040.0319.20
5.2.160.0020.0319.21
5.2.150.0040.0309.21
5.2.140.0040.0319.20
5.2.130.0080.0269.16
5.2.120.0030.0309.16
5.2.110.0070.0339.17
5.2.100.0050.0339.17
5.2.90.0040.0309.16
5.2.80.0050.0299.16
5.2.70.0060.0299.16
5.2.60.0050.0309.12
5.2.50.0060.0289.09
5.2.40.0060.0279.06
5.2.30.0060.0289.04
5.2.20.0040.0349.03
5.2.10.0030.0308.94
5.2.00.0040.0298.79
5.1.60.0020.0268.06
5.1.50.0050.0248.06
5.1.40.0040.0248.04
5.1.30.0080.0228.39
5.1.20.0040.0308.41
5.1.10.0050.0258.14
5.1.00.0040.0258.14
5.0.50.0030.0216.62
5.0.40.0060.0256.48
5.0.30.0040.0356.29
5.0.20.0020.0246.26
5.0.10.0020.0216.24
5.0.00.0040.0306.24
4.4.90.0020.0164.78
4.4.80.0040.0144.75
4.4.70.0030.0154.76
4.4.60.0020.0164.75
4.4.50.0050.0134.77
4.4.40.0020.0264.70
4.4.30.0040.0154.76
4.4.20.0020.0164.84
4.4.10.0040.0144.85
4.4.00.0070.0214.76
4.3.110.0040.0144.67
4.3.100.0000.0174.67
4.3.90.0020.0154.63
4.3.80.0030.0244.58
4.3.70.0030.0144.63
4.3.60.0040.0134.62
4.3.50.0020.0174.63
4.3.40.0030.0244.53
4.3.30.0010.0193.29
4.3.20.0030.0143.27
4.3.10.0020.0153.23
4.3.00.0000.0237.00

preferences:
51.46 ms | 401 KiB | 5 Q