3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); $results = array(); for($i = 0; $i < 3000; $i++) { $results[] = (object) rand(0, 100000); } $start = microtime(true); for($i = 0; $i < 1000; $i++) { $alreadyOutput = array(); foreach ($results as $result) { if(in_array($result->date, $alreadyOutput)){ continue; } $alreadyOutput[] = $result->date; } } echo "in_array: ".(microtime(true) - $start)."ms || "; $start2 = microtime(true); for($i = 0; $i < 1000; $i++) { $echoedArray = array(); foreach ($results as $result) { if ($echoedArray[$result->date]) { continue; } $echoedArray[$result->date] = true; } } echo "by key: ".(microtime(true) - $start2)."ms";

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.00.0132.48416.41
7.3.120.0072.49115.92
7.3.110.0102.24116.21
7.3.100.0072.49116.38
7.3.90.0002.49616.20
7.3.80.0072.14316.19
7.3.70.0072.26016.11
7.3.60.0032.37516.15
7.3.50.0032.49216.11
7.3.40.0102.09816.04
7.3.30.0072.46416.26
7.3.20.0072.19516.89
7.3.10.0072.48716.62
7.3.00.0032.23216.74
7.2.250.0132.48416.64
7.2.240.0132.48516.50
7.2.230.0002.49816.54
7.2.220.0132.11916.66
7.2.210.0002.49816.35
7.2.200.0032.49516.26
7.2.190.0102.48816.36
7.2.180.0032.49416.14
7.2.170.0132.48416.48
7.2.00.0031.49219.48
7.1.330.0002.49215.88
7.1.320.0032.49515.88
7.1.310.0032.49515.94
7.1.300.0072.48915.59
7.1.290.0072.48615.59
7.1.280.0002.49515.86
7.1.270.0102.48716.08
7.1.260.0102.48715.98
7.1.70.0031.55017.43
7.1.60.0031.36919.46
7.1.50.0101.42017.20
7.1.00.0031.75022.65
7.0.200.0031.38116.73
7.0.140.0072.17022.13
7.0.60.0131.43321.46
7.0.50.0101.38719.36
7.0.40.0201.38719.90
7.0.30.0371.36720.30
7.0.20.0271.40020.02
7.0.10.0131.53020.16
7.0.00.0071.45720.09
5.6.280.0071.76322.65
5.6.210.0071.89322.05
5.6.200.0101.84319.73
5.6.190.0071.90021.67
5.6.180.0331.85021.83
5.6.170.0271.96321.88
5.6.160.0101.78021.91
5.6.150.0031.90319.60
5.6.140.0101.85019.70
5.6.130.0001.77719.63
5.6.120.0071.87322.56
5.6.110.1801.85022.51
5.6.100.0171.82722.53
5.6.90.0171.84322.51
5.6.80.0101.96021.92
5.6.70.4531.58321.93
5.5.350.0101.60321.93
5.5.340.0031.85719.43
5.5.330.0031.83721.68
5.5.320.0201.82321.74
5.5.310.0301.88321.74
5.5.300.0101.88019.51
5.5.290.0101.85019.48
5.5.280.0001.82722.32
5.5.270.0032.22322.20
5.5.260.0171.86022.34
5.5.250.0101.86722.13
5.5.240.0201.76321.80
5.4.450.0301.73320.89
5.4.440.0672.36321.22
5.4.430.1601.71021.07
5.4.420.0201.96720.82
5.4.410.0071.83720.95
5.4.400.0301.42720.77
5.4.390.0271.48320.91
5.4.380.0502.18720.41
5.4.370.0432.12020.29
5.4.360.0402.03320.22
5.4.350.0302.24320.29
5.4.340.0332.42320.45
5.4.320.0101.99214.21
5.4.310.0091.99414.21
5.4.300.0161.98514.21
5.4.290.0141.98914.21
5.4.280.0101.99314.11
5.4.270.0121.99314.10
5.4.260.0121.99114.10
5.4.250.0091.99314.11
5.4.240.0041.99814.10
5.4.230.0071.99414.10
5.4.220.0121.99014.09
5.4.210.0081.99214.09
5.4.200.0091.99214.10
5.4.190.0111.99114.09
5.4.180.0121.98914.09
5.4.170.0061.99714.11
5.4.160.0081.99214.10
5.4.150.0061.99814.09
5.4.140.0141.98613.78
5.4.130.0132.02713.77
5.4.120.0111.99013.73
5.4.110.0131.98913.72
5.4.100.0091.99413.72
5.4.90.0091.99213.72
5.4.80.0121.99013.72
5.4.70.0081.99413.72
5.4.60.0141.98713.72
5.4.50.0111.99013.71
5.4.40.0091.99113.71
5.4.30.0161.98713.71
5.4.20.0101.99213.70
5.4.10.0071.99513.71
5.4.00.0091.99313.19
5.3.290.0131.99014.38
5.3.280.0081.99314.31
5.3.270.0131.98814.33
5.3.260.0101.99214.32
5.3.250.0091.99214.32
5.3.240.0191.98214.32
5.3.230.0171.98214.32
5.3.220.0081.99414.29
5.3.210.0091.99214.29
5.3.200.0141.99014.29
5.3.190.0101.99314.29
5.3.180.0111.99714.28
5.3.170.0071.99614.29
5.3.160.0151.98814.29
5.3.150.0081.99414.29
5.3.140.0191.98514.28
5.3.130.0121.99214.27
5.3.120.0141.98614.27
5.3.110.0111.99114.27
5.3.100.0161.98613.75
5.3.90.0151.98613.74
5.3.80.0111.98913.73
5.3.70.0101.99113.73
5.3.60.0121.98913.71
5.3.50.0111.99213.66
5.3.40.0171.98713.66
5.3.30.0151.99113.63
5.3.20.0071.99513.41
5.3.10.0091.99313.37
5.3.00.0111.99213.35
5.2.170.0081.99210.66
5.2.160.0081.99410.66
5.2.150.0141.99010.68
5.2.140.0101.99010.65
5.2.130.0191.98610.62
5.2.120.0181.98810.62
5.2.110.0051.99610.62
5.2.100.0081.99210.61
5.2.90.0101.99110.61
5.2.80.0051.99610.61
5.2.70.0081.99310.61
5.2.60.0081.99110.56
5.2.50.0121.98810.53
5.2.40.0091.99210.50
5.2.30.0111.98810.48
5.2.20.0121.98910.47
5.2.10.0291.96610.43
5.2.00.0581.94110.28
5.1.60.0251.97810.00
5.1.50.0201.98010.00
5.1.40.0141.9889.98
5.1.30.0101.99210.32
5.1.20.0071.99610.35
5.1.10.0081.99310.08
5.1.00.0131.98910.07
5.0.50.0101.9938.54
5.0.40.0051.9968.39
5.0.30.0051.9968.21
5.0.20.0081.9948.17
5.0.10.0091.9928.15
5.0.00.0061.9958.15
4.4.90.0111.9936.29
4.4.80.0061.9956.27
4.4.70.0051.9936.26
4.4.60.0081.9946.24
4.4.50.0041.9986.29
4.4.40.0061.9966.25
4.4.30.0041.9966.25
4.4.20.0061.9966.34
4.4.10.0061.9956.34
4.4.00.0111.9906.28
4.3.110.0061.9956.21
4.3.100.0081.9936.20
4.3.90.0071.9976.17
4.3.80.0091.9936.17
4.3.70.0061.9956.16
4.3.60.0071.9946.17
4.3.50.0071.9936.17
4.3.40.0091.9926.12
4.3.30.0071.9934.93
4.3.20.0051.9974.91
4.3.10.0051.9974.87
4.3.00.0071.41718.56

preferences:
37.54 ms | 401 KiB | 5 Q