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) { list($item, ) = explode(".", $value); 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.0070.00718.43
8.3.50.0080.01021.09
8.3.40.0100.01018.92
8.3.30.0070.00719.22
8.3.20.0040.00420.39
8.3.10.0040.00423.48
8.3.00.0060.00319.50
8.2.180.0040.01516.75
8.2.170.0040.01122.96
8.2.160.0030.01020.46
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0040.00422.22
8.2.110.0100.00022.20
8.2.100.0090.00317.83
8.2.90.0040.00419.20
8.2.80.0040.00417.97
8.2.70.0040.00417.63
8.2.60.0040.00418.05
8.2.50.0080.00018.07
8.2.40.0030.00619.88
8.2.30.0040.00418.23
8.2.20.0040.00417.80
8.2.10.0000.00818.11
8.2.00.0000.00817.64
8.1.280.0090.00925.92
8.1.270.0000.01023.91
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0040.00421.43
8.1.230.0040.00817.45
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0000.00817.13
8.1.190.0040.00417.22
8.1.180.0080.00018.10
8.1.170.0040.00418.64
8.1.160.0080.00021.98
8.1.150.0000.00718.87
8.1.140.0050.00217.38
8.1.130.0000.00817.74
8.1.120.0030.00317.52
8.1.110.0040.00417.48
8.1.100.0040.00417.35
8.1.90.0040.00417.49
8.1.80.0040.00417.36
8.1.70.0080.00017.36
8.1.60.0060.00317.59
8.1.50.0040.00417.40
8.1.40.0070.00017.52
8.1.30.0030.00517.68
8.1.20.0080.00017.50
8.1.10.0040.00417.55
8.1.00.0040.00417.49
8.0.300.0070.00018.77
8.0.290.0000.00716.88
8.0.280.0070.00018.39
8.0.270.0030.00317.12
8.0.260.0030.00317.27
8.0.250.0060.00016.88
8.0.240.0000.00716.91
8.0.230.0000.00816.93
8.0.220.0040.00316.78
8.0.210.0000.00816.80
8.0.200.0030.00316.82
8.0.190.0040.00416.94
8.0.180.0070.00016.91
8.0.170.0040.00416.79
8.0.160.0000.00716.95
8.0.150.0000.01016.93
8.0.140.0040.00416.77
8.0.130.0070.00013.32
8.0.120.0000.00716.75
8.0.110.0030.00616.87
8.0.100.0040.00416.90
8.0.90.0030.00516.77
8.0.80.0060.00916.86
8.0.70.0000.00716.72
8.0.60.0050.00316.77
8.0.50.0000.00716.75
8.0.30.0110.00916.92
8.0.20.0090.01017.40
8.0.10.0000.00716.82
8.0.00.0070.01116.62
7.4.330.0060.00015.09
7.4.320.0030.00316.36
7.4.300.0030.00316.51
7.4.290.0030.00316.51
7.4.280.0040.00416.57
7.4.270.0000.00716.43
7.4.260.0000.00716.48
7.4.250.0030.00316.57
7.4.240.0000.00816.54
7.4.230.0000.00716.33
7.4.220.0140.00416.54
7.4.210.0060.00916.46
7.4.200.0020.00516.40
7.4.160.0160.00416.62
7.4.150.0070.01117.40
7.4.140.0120.00817.86
7.4.130.0060.01116.59
7.4.120.0070.01016.52
7.4.110.0130.00316.52
7.4.100.0060.01216.50
7.4.90.0130.00316.48
7.4.80.0030.02019.39
7.4.70.0040.01416.41
7.4.60.0100.00716.40
7.4.50.0000.00816.56
7.4.40.0040.01516.22
7.4.30.0090.00616.41
7.4.00.0090.00615.14
7.3.330.0030.00313.06
7.3.320.0000.00513.30
7.3.310.0000.00716.36
7.3.300.0060.00016.23
7.3.290.0090.00716.34
7.3.280.0080.01016.29
7.3.270.0150.00317.40
7.3.260.0140.01016.34
7.3.250.0090.00916.46
7.3.240.0040.01416.33
7.3.230.0070.01016.39
7.3.210.0070.01016.23
7.3.200.0100.00719.39
7.3.190.0070.01016.36
7.3.180.0060.00916.58
7.3.170.0060.01216.27
7.3.160.0030.01216.46
7.3.10.0090.00716.51
7.3.00.0100.01116.52
7.2.330.0060.01316.64
7.2.320.0030.01416.45
7.2.310.0070.01116.60
7.2.300.0120.00616.59
7.2.290.0060.01216.60
7.2.130.0130.00516.56
7.2.120.0120.00516.75
7.2.110.0050.01016.56
7.2.100.0080.01116.57
7.2.90.0100.00816.64
7.2.80.0130.00816.71
7.2.70.0120.00716.96
7.2.60.0080.00816.75
7.2.50.0140.00216.80
7.2.40.0110.00816.74
7.2.30.0100.00616.72
7.2.20.0120.00716.65
7.2.10.0090.00716.72
7.2.00.0150.00316.98
7.1.250.0080.00515.50
7.1.200.0060.00615.85
7.1.70.0000.00717.04
7.1.60.0030.02119.11
7.1.50.0100.01316.93
7.1.00.0070.07322.45
7.0.200.0100.00016.82
7.0.140.0000.08022.07
7.0.60.0070.08319.91
7.0.50.0170.07317.89
7.0.40.0030.04320.23
7.0.30.0330.05020.10
7.0.20.0200.04720.06
7.0.10.0100.07020.24
7.0.00.0070.08020.32
5.6.280.0000.07720.82
5.6.210.0030.06720.46
5.6.200.0030.06018.23
5.6.190.0130.08020.48
5.6.180.0270.07720.57
5.6.170.0200.04320.52
5.6.160.0070.04020.71
5.6.150.0100.06318.21
5.6.140.0030.08018.14
5.6.130.0130.07318.26
5.6.120.0200.07021.02
5.6.110.0300.07020.98
5.6.100.0030.04320.97
5.6.90.0130.05721.01
5.6.80.0230.04320.38
5.6.70.3900.03720.35
5.5.350.0200.08020.44
5.5.340.0000.04317.98
5.5.330.0070.04020.47
5.5.320.0330.04720.36
5.5.310.0130.05320.41
5.5.300.0070.07717.95
5.5.290.0070.07317.95
5.5.280.0000.04320.96
5.5.270.0100.07720.89
5.5.260.0030.05720.79
5.5.250.0170.07320.68
5.5.240.0270.06020.07
5.4.450.0630.06019.55
5.4.440.0530.05319.61
5.4.430.0530.06019.38
5.4.420.0700.00019.53
5.4.410.0600.00019.57
5.4.400.0630.00019.08
5.4.390.0600.00019.02
5.4.380.0630.00019.13
5.4.370.0600.00019.04
5.4.360.0830.00019.21
5.4.350.0630.00018.98
5.4.340.0070.03312.00
5.4.320.0090.03412.48
5.4.310.0040.04212.48
5.4.300.0060.03512.48
5.4.290.0050.03912.48
5.4.280.0050.03512.38
5.4.270.0040.03812.38
5.4.260.0050.04012.38
5.4.250.0050.03812.38
5.4.240.0070.03512.38
5.4.230.0060.03612.37
5.4.220.0060.04012.37
5.4.210.0030.03812.37
5.4.200.0050.03812.37
5.4.190.0040.03712.37
5.4.180.0070.04012.37
5.4.170.0110.03212.38
5.4.160.0060.03712.38
5.4.150.0100.03712.37
5.4.140.0080.04012.05
5.4.130.0060.03612.04
5.4.120.0060.03712.00
5.4.110.0040.03811.99
5.4.100.0060.03511.99
5.4.90.0060.03712.00
5.4.80.0050.05412.00
5.4.70.0050.03611.99
5.4.60.0060.03511.99
5.4.50.0080.03411.99
5.4.40.0050.03711.98
5.4.30.0050.03811.98
5.4.20.0050.03611.98
5.4.10.0090.03111.98
5.4.00.0070.03311.47
5.3.290.0040.04412.80
5.3.280.0080.03612.71
5.3.270.0040.04012.73
5.3.260.0060.04512.72
5.3.250.0030.04012.71
5.3.240.0110.03412.71
5.3.230.0060.04312.71
5.3.220.0060.03912.68
5.3.210.0080.03812.68
5.3.200.0100.03812.68
5.3.190.0090.03412.67
5.3.180.0030.03912.67
5.3.170.0080.03612.66
5.3.160.0080.03512.68
5.3.150.0040.03912.67
5.3.140.0050.03812.66
5.3.130.0070.04012.66
5.3.120.0050.04012.66
5.3.110.0040.04112.66
5.3.100.0090.03512.12
5.3.90.0080.03612.09
5.3.80.0090.03412.08
5.3.70.0040.04012.08
5.3.60.0070.03612.07
5.3.50.0050.04212.02
5.3.40.0060.03812.02
5.3.30.0110.03511.98
5.3.20.0070.03411.75
5.3.10.0090.03211.71
5.3.00.0040.03811.70
5.2.170.0060.0299.21
5.2.160.0080.0259.21
5.2.150.0030.0329.21
5.2.140.0050.0299.20
5.2.130.0030.0309.17
5.2.120.0040.0299.17
5.2.110.0030.0309.17
5.2.100.0080.0409.17
5.2.90.0070.0329.16
5.2.80.0030.0339.16
5.2.70.0080.0299.16
5.2.60.0090.0299.11
5.2.50.0060.0299.08
5.2.40.0050.0309.06
5.2.30.0050.0299.04
5.2.20.0060.0289.03
5.2.10.0080.0278.93
5.2.00.0060.0278.80
5.1.60.0060.0228.07
5.1.50.0030.0258.06
5.1.40.0030.0298.04
5.1.30.0030.0318.39
5.1.20.0060.0258.41
5.1.10.0050.0248.14
5.1.00.0050.0268.14
5.0.50.0060.0186.62
5.0.40.0040.0206.48
5.0.30.0020.0326.30
5.0.20.0040.0196.25
5.0.10.0040.0196.24
5.0.00.0060.0366.24
4.4.90.0030.0254.77
4.4.80.0030.0164.76
4.4.70.0040.0154.76
4.4.60.0040.0184.75
4.4.50.0060.0194.77
4.4.40.0040.0304.71
4.4.30.0050.0194.76
4.4.20.0030.0154.84
4.4.10.0040.0144.85
4.4.00.0030.0244.75
4.3.110.0030.0154.67
4.3.100.0040.0134.66
4.3.90.0040.0134.63
4.3.80.0030.0244.58
4.3.70.0030.0144.63
4.3.60.0040.0134.63
4.3.50.0040.0144.63
4.3.40.0020.0244.53
4.3.30.0040.0143.30
4.3.20.0020.0163.27
4.3.10.0040.0143.23
4.3.00.0100.0237.00

preferences:
60.09 ms | 401 KiB | 5 Q