3v4l.org

run code in 300+ PHP versions simultaneously
<?php $max = 100000; $arr = range(1,$max,3); $arr2 = range(1,$max,2); $arr = array_merge($arr,$arr2); //echo '<pre>'; print_r($arr); echo '</pre>'; // ----------------------------------------- $time = -microtime(true); $res1 = array_unique($arr); $time += microtime(true); echo "deduped to ".count($res1)." in ".$time; //echo '<pre>'; print_r($res1); echo '</pre>'; // deduped to 666667 in 32.300781965256 unset($res1); $time = -microtime(true); $res2 = array(); foreach($arr as $key=>$val) { $res2[$val] = true; } $res2 = array_keys($res2); $time += microtime(true); echo "<br />deduped to ".count($res2)." in ".$time; //echo '<pre>'; print_r($res2); echo '</pre>'; // deduped to 666667 in 0.84372591972351 unset($res2); // array_flip $time = -microtime(true); $res3 = array_flip(array_flip($arr)); //$res3 = array_flip($res3); $time += microtime(true); echo "<br />deduped to ".count($res3)." in ".$time;

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.4.10.0410.02529.97
7.4.00.0300.03029.83
7.3.130.0290.03029.79
7.3.120.0340.02229.76
7.3.110.0310.02629.78
7.3.100.0170.02629.58
7.3.90.0250.02729.95
7.3.80.0230.02829.88
7.3.70.0140.02529.84
7.3.60.0240.02729.75
7.3.50.0190.02429.70
7.3.40.0240.02029.74
7.3.30.0190.02129.60
7.3.20.0290.01835.31
7.3.10.0130.02035.34
7.3.00.0130.02335.25
7.2.260.0290.03628.96
7.2.250.0280.03528.97
7.2.240.0150.02529.17
7.2.230.0190.03528.92
7.2.220.0160.03028.90
7.2.210.0280.02328.85
7.2.200.0110.02828.96
7.2.190.0220.03028.90
7.2.180.0240.02729.00
7.2.170.0290.01328.81
7.2.160.0220.02728.92
7.2.150.0200.02035.40
7.2.140.0110.02435.36
7.2.130.0100.02635.54
7.2.120.0210.02335.46
7.2.110.0280.02835.06
7.2.100.0190.02635.11
7.2.90.0330.01935.06
7.2.80.0270.03235.00
7.2.70.0350.02335.31
7.2.60.0570.02635.20
7.2.50.0390.02235.21
7.2.40.0260.02635.28
7.2.30.0410.02435.19
7.2.20.0890.02535.23
7.2.10.0220.02035.15
7.2.00.0220.02035.77
7.1.330.0200.13732.75
7.1.320.0220.14432.50
7.1.310.0130.14532.38
7.1.300.0250.13532.65
7.1.290.0200.14732.64
7.1.280.0130.14632.54
7.1.270.0080.15532.65
7.1.260.0200.14132.57
7.1.250.0150.16232.64
7.1.240.0250.14232.53
7.1.230.0240.13132.18
7.1.220.0260.14332.29
7.1.210.0430.15132.11
7.1.200.0190.13832.24
7.1.190.0420.14132.22
7.1.180.0210.13432.22
7.1.170.0310.13532.18
7.1.160.0360.13032.08
7.1.150.0520.14332.26
7.1.140.1000.13832.25
7.1.130.2030.14932.33
7.1.120.0180.13432.15
7.1.110.0760.12932.32
7.1.100.0140.16232.30
7.1.90.0340.13032.38
7.1.80.0200.14832.22
7.1.70.0600.15232.33
7.1.60.0240.12532.66
7.1.50.0120.12127.36
7.1.40.0240.14631.36
7.1.30.0310.13232.32
7.1.20.2160.13932.36
7.1.10.0330.08525.33
7.1.00.0430.14633.75
7.0.330.0200.14232.06
7.0.320.0180.15832.31
7.0.310.0260.13032.04
7.0.300.1020.13831.86
7.0.290.0540.12831.86
7.0.280.0520.13031.92
7.0.270.0140.13631.98
7.0.260.0200.13131.97
7.0.250.0150.13631.94
7.0.240.0540.14731.89
7.0.230.0210.12432.01
7.0.220.0430.14531.91
7.0.210.1190.12532.06
7.0.200.0690.14032.18
7.0.190.0160.09225.27
7.0.180.0470.10925.32
7.0.170.0310.15131.90
7.0.160.0140.08625.19
7.0.150.0710.14531.87
7.0.140.0650.13833.36
7.0.130.0330.12431.98
7.0.120.1450.13732.11
7.0.110.0390.12231.93
7.0.100.1060.13332.06
7.0.90.0210.14231.98
7.0.80.1010.14332.15
7.0.70.0590.14131.93
7.0.60.0950.14432.11
7.0.50.0710.15231.48
7.0.40.0190.14728.39
7.0.30.0500.14128.38
7.0.20.0540.14528.48
7.0.10.0220.12624.32
7.0.00.0100.16128.51
5.6.400.0290.61952.26
5.6.390.0220.61752.48
5.6.380.0370.57752.16
5.6.370.0330.54251.86
5.6.360.0320.52452.20
5.6.350.0330.53752.03
5.6.340.0370.58052.22
5.6.330.0380.58252.00
5.6.320.0290.58152.05
5.6.310.0460.49752.18
5.6.300.0310.35338.69
5.6.290.0270.38238.69
5.6.280.0250.44043.47
5.6.270.0270.36238.72
5.6.260.0290.39338.70
5.6.250.0320.40638.63
5.6.240.0370.45348.42
5.6.230.0290.62952.21
5.6.220.0270.58552.13
5.6.210.0400.54053.49
5.6.200.0320.52353.00
5.6.190.0280.60553.51
5.6.180.0400.50853.58
5.6.170.0330.48953.43
5.6.160.0280.47050.78
5.6.150.0280.57052.95
5.6.140.0280.55150.19
5.6.130.0260.51450.06
5.6.120.0280.51553.68
5.6.110.0280.40243.58
5.6.100.0300.59753.68
5.6.90.0200.41543.52
5.6.80.0320.53653.48
5.6.70.0250.38638.67
5.6.60.0200.52348.34
5.6.50.0270.62752.08
5.6.40.0320.58252.11
5.6.30.0410.64552.00
5.6.20.0330.63251.99
5.6.10.0300.58352.09
5.6.00.0290.41638.59
5.5.380.0330.52151.04
5.5.370.0260.55251.03
5.5.360.0270.53447.30
5.5.350.0250.48752.76
5.5.340.0320.60352.10
5.5.330.0270.57152.66
5.5.320.0340.54152.54
5.5.310.0210.50852.63
5.5.300.0270.52752.11
5.5.290.0330.59552.13
5.5.280.0230.49750.01
5.5.270.0380.51752.78
5.5.260.0270.46149.77
5.5.250.0260.57252.70
5.5.240.0280.41949.86
5.5.230.0300.52647.18
5.5.220.0330.55751.02
5.5.210.0310.57550.86
5.5.200.0390.55650.93
5.5.190.0240.58851.03
5.5.180.0310.53451.10
5.5.170.0320.63452.08
5.5.160.0390.53751.05
5.5.150.0260.49947.15
5.5.140.0330.57951.08
5.5.130.0190.42937.46
5.5.120.0370.52651.02
5.5.110.0180.39637.64
5.5.100.0350.61451.02
5.5.90.0140.46737.52
5.5.80.0300.61450.95
5.5.70.0310.60850.36
5.5.60.0360.49450.90
5.5.50.0420.59050.87
5.5.40.0270.58751.04
5.5.30.0380.60151.08
5.5.20.0350.60251.00
5.5.10.0320.52650.86
5.5.00.0230.60451.08
5.4.450.1200.53350.81
5.4.440.1170.52750.75
5.4.430.1370.49550.75
5.4.420.1220.57050.67
5.4.410.1280.52050.67
5.4.400.0910.56250.60
5.4.390.0560.54550.63
5.4.380.1230.52650.56
5.4.370.1480.58650.61
5.4.360.1240.58450.55
5.4.350.1300.56350.60
5.4.340.0320.58250.65
5.4.330.0350.52948.79
5.4.320.1370.53150.63
5.4.310.1210.48850.59
5.4.300.1240.53450.68
5.4.290.1470.52350.47
5.4.280.0300.50250.53
5.4.270.1210.55850.59
5.4.260.1270.54550.67
5.4.250.1080.54750.65
5.4.240.1180.49750.56
5.4.230.1270.57150.55
5.4.220.1260.55850.69
5.4.210.1310.50850.56
5.4.200.1380.60450.61
5.4.190.1330.59150.58
5.4.180.1240.55050.60
5.4.170.1240.51450.49
5.4.160.1220.49650.71
5.4.150.1320.57850.47
5.4.140.1520.58150.01
5.4.130.0630.54849.96
5.4.120.1250.53449.93
5.4.110.1170.48850.13
5.4.100.1150.59949.91
5.4.90.1080.57949.98
5.4.80.1140.57349.97
5.4.70.1490.55649.89
5.4.60.1390.52950.05
5.4.50.1230.57749.95
5.4.40.1340.57349.87
5.4.30.1350.53849.95
5.4.20.1230.58050.04
5.4.10.1290.51249.87
5.4.00.1250.51449.83
5.3.290.1110.54449.16
5.3.280.1180.53749.04
5.3.270.1310.55549.14
5.3.260.1300.55549.07
5.3.250.1160.50449.06
5.3.240.0590.61548.94
5.3.230.0900.57249.02
5.3.220.1510.56349.01
5.3.210.1150.59248.98
5.3.200.1200.53848.98
5.3.190.1280.55449.02
5.3.180.1190.59449.13
5.3.170.1310.62449.09
5.3.160.1350.54049.10
5.3.150.1300.62949.08
5.3.140.1190.61549.06
5.3.130.1170.52549.06
5.3.120.1240.58549.07
5.3.110.1260.62649.04
5.3.100.1310.56148.90
5.3.90.1150.60748.92
5.3.80.1310.67248.74
5.3.70.1240.63148.70
5.3.60.1270.60048.84
5.3.50.0310.63748.80
5.3.40.0510.57048.83
5.3.30.1240.57848.76
5.3.20.1160.51048.73
5.3.10.1220.54148.54
5.3.00.0260.48848.34
5.2.170.0170.45545.30
5.2.160.0150.44545.36
5.2.150.1970.41845.28
5.2.140.1760.39845.21
5.2.130.1550.42745.23
5.2.120.1680.41345.10
5.2.110.2000.43745.26
5.2.100.0220.44845.85
5.2.90.0170.13045.12
5.2.80.0220.43744.93
5.2.70.2230.45344.79
5.2.60.2130.44745.27
5.2.50.1770.42544.91
5.2.40.1470.43144.96
5.2.30.1620.55544.81
5.2.20.1480.46444.99
5.2.10.1450.64444.53
5.2.00.1680.59644.47
5.1.60.1570.65755.24
5.1.50.2630.72455.25
5.1.40.2200.71055.30
5.1.30.1520.66355.44
5.1.20.1750.66355.50
5.1.10.1340.70555.36
5.1.00.1770.66655.15
5.0.50.0580.71954.06
5.0.40.0370.80853.86
5.0.30.0850.80053.70
5.0.20.0650.73453.84
5.0.10.0500.71653.67
5.0.00.0500.79053.64
4.4.90.0830.0129.61
4.4.80.0730.0139.61
4.4.70.0750.0109.61
4.4.60.0830.0109.61
4.4.50.0790.0109.61
4.4.40.0740.0169.61
4.4.30.0830.0119.61
4.4.20.0730.0109.61
4.4.10.0440.0109.61
4.4.00.0450.0159.61
4.3.110.0700.0109.61
4.3.100.0600.0089.61
4.3.90.0390.0089.61
4.3.80.0530.0129.61
4.3.70.0420.0119.61
4.3.60.0410.0079.61
4.3.50.0500.0099.61
4.3.40.0680.0189.61
4.3.30.0320.0109.61
4.3.20.0320.0089.61
4.3.10.0330.0089.61
4.3.00.0310.0109.61

preferences:
30.71 ms | 401 KiB | 5 Q