3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('memory_limit', '512m'); $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 $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 // 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.3.10.0260.02042.61
7.3.00.0340.01542.35
7.2.130.0230.02040.96
7.2.120.0460.01040.94
7.2.110.0280.01640.92
7.2.100.0170.01740.95
7.2.90.0190.01940.80
7.2.80.0180.03140.89
7.2.70.0190.01940.91
7.2.60.0160.02640.88
7.2.50.0240.02040.96
7.2.40.0160.02040.77
7.2.30.0190.02540.98
7.2.20.0130.02340.92
7.2.10.0230.01740.79
7.2.00.0330.02242.11
7.1.250.0450.15339.75
7.1.70.0000.09941.13
7.1.60.0100.09641.14
7.1.50.0140.15341.11
7.1.00.0070.11346.34
7.0.200.0730.14640.89
7.0.140.0130.18346.10
7.0.60.0170.17336.71
7.0.50.0170.19034.60
7.0.40.0230.18334.41
7.0.30.0870.12334.35
7.0.20.1000.16734.49
7.0.10.0230.18034.43
7.0.00.0230.13734.39
5.6.280.0200.52373.93
5.6.210.0400.45773.36
5.6.200.0270.46070.89
5.6.190.0230.63773.30
5.6.180.0670.60373.03
5.6.170.0300.42773.11
5.6.160.0330.49073.07
5.6.150.0100.42370.84
5.6.140.0270.47070.94
5.6.130.0230.48070.94
5.6.120.0370.57073.80
5.6.110.0270.48073.79
5.6.100.0200.41373.82
5.6.90.0170.58073.77
5.6.80.0400.47773.23
5.5.350.0470.47073.11
5.5.340.0130.49070.77
5.5.330.0330.46373.08
5.5.320.0430.43773.04
5.5.310.1200.41772.97
5.5.300.0200.58770.69
5.5.290.0230.42770.74
5.5.280.0270.46773.79
5.5.270.0170.48773.65
5.5.260.0270.45773.78
5.5.250.0230.56073.48
5.5.240.0470.43073.09
5.4.450.0300.39372.14
5.4.440.0270.39372.16
5.4.430.0430.41072.30
5.4.420.0400.40772.00
5.4.410.0630.47771.87
5.4.400.0570.42071.89
5.4.390.0430.40071.79
5.4.380.0370.42071.88
5.4.370.1400.40371.68
5.4.360.0370.43771.81
5.4.350.0470.40771.78
5.4.340.0470.48071.63
5.4.320.0500.53371.82
5.4.310.0370.46071.99
5.4.300.0500.41371.63
5.4.290.0470.42771.80
5.4.280.0330.38371.77
5.4.270.0500.39771.98
5.4.260.0400.45771.87
5.4.250.0300.42371.54
5.4.240.0270.42371.56
5.4.230.0470.44071.92
5.4.220.0500.43771.77
5.4.210.0430.39771.77
5.4.200.0300.44771.96
5.4.190.0400.37371.51
5.4.180.0430.40771.77
5.4.170.0570.39771.77
5.4.160.0500.48071.66
5.4.150.0670.42771.55
5.4.140.0430.45069.03
5.4.130.0400.43069.07
5.4.120.0400.51069.04
5.4.110.0600.42369.09
5.4.100.0430.45369.17
5.4.90.0470.40069.18
5.4.80.1030.43769.11
5.4.70.0270.45769.07
5.4.60.0430.46369.09
5.4.50.0270.39068.84
5.4.40.0430.37069.16
5.4.30.0370.37769.10
5.4.20.0430.37369.10
5.4.10.0300.39769.20
5.4.00.0270.39768.57
5.3.290.1300.46367.80
5.3.280.0470.45067.61
5.3.270.1170.48367.87
5.3.260.0330.53767.64
5.3.250.0370.41767.72
5.3.240.0500.48367.62
5.3.230.0370.42067.64
5.3.220.0630.44767.70
5.3.210.0470.46067.67
5.3.200.0400.49767.70
5.3.190.0430.48767.61
5.3.180.0600.54067.71
5.3.170.0500.46767.61
5.3.160.0530.47767.60
5.3.150.0370.50767.69
5.3.140.0330.42067.82
5.3.130.0470.45367.58
5.3.120.0370.46367.70
5.3.110.0200.42067.63
5.3.100.0370.45767.05
5.3.90.0300.45766.39
5.3.80.0370.45066.96
5.3.70.0200.45067.00
5.3.60.0570.44767.18
5.3.50.0370.45767.12
5.3.40.0500.46066.89
5.3.30.0530.46066.89
5.3.20.0570.45766.87
5.3.10.0500.50766.63
5.3.00.0430.42065.98
5.2.170.0430.44762.11
5.2.160.0330.48062.20
5.2.150.0370.46062.35
5.2.140.0530.50762.13
5.2.130.0430.49062.22
5.2.120.0430.51362.04
5.2.110.0330.52062.06
5.2.100.0430.45362.17
5.2.90.0400.17762.19
5.2.80.0970.48362.07
5.2.70.0500.46762.18
5.2.60.0370.51762.02
5.2.50.0370.48761.45
5.2.40.0430.52761.27
5.2.30.0370.50061.27
5.2.20.0430.48761.43
5.2.10.0570.74761.15
5.2.00.0330.72060.87
5.1.60.0400.72775.97
5.1.50.0470.68775.98
5.1.40.0430.72775.89
5.1.30.0370.73076.36
5.1.20.0370.73076.42
5.1.10.0370.70776.05
5.1.00.0330.73075.98
5.0.50.1630.84074.63
5.0.40.0200.78074.48
5.0.30.0270.84074.19
5.0.20.0230.80074.28
5.0.10.0830.78774.24
5.0.00.0300.77074.06
4.4.90.0130.02011.33
4.4.80.0070.01711.33
4.4.70.0130.03711.33
4.4.60.0100.02011.33
4.4.50.0130.02711.33
4.4.40.0030.04011.33
4.4.30.0070.03011.33
4.4.20.0130.03311.33
4.4.10.0100.03311.33
4.4.00.0070.04711.33
4.3.110.0130.02311.33
4.3.100.0100.02011.33
4.3.90.0070.02711.33
4.3.80.0030.05011.33
4.3.70.0070.03311.33
4.3.60.0070.02011.33
4.3.50.0070.01711.33
4.3.40.0100.03711.33
4.3.30.0100.02711.33
4.3.20.0070.02011.33
4.3.10.0030.02711.33
4.3.00.0030.03011.33

preferences:
36.51 ms | 401 KiB | 5 Q