3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array("url" => "1", "priority" => 2), array("url" => "http://facebook.com", "priority" => 2), array("url" => "http://youtube.com", "priority" => 2), array("url" => "http://stackoverflow.com", "priority" => 1), array("url" => "http://kickass.to", "priority" => 1), array("url" => "http://twitter.com", "priority" => 1), array("url" => "http://example.com", "priority" => 1), ); // Recreate another array where we have multiple occurence of the same value (nb_of_occurence = priority) $listOfUrl = array(); foreach ($arr as $url) { $nbOfOccurence = $url['priority']; for($i = 0 ; $i < $nbOfOccurence ; $i++) { $listOfUrl[] = $url['url']; } } // Count the number of elements in this new array $nbOfElement = count($listOfUrl); // Generate a random index between 0 and (number of element - 1) $randomIndex = rand(0,($nbOfElement - 1)); // Retrive the random value $randomURL = $listOfUrl[$randomIndex]; echo $randomURL;

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.0030.01415.06
7.4.00.0070.01015.04
7.3.130.0070.01014.86
7.3.120.0070.01114.90
7.3.110.0040.01314.93
7.3.100.0060.00914.91
7.3.90.0040.00914.72
7.3.80.0070.00714.79
7.3.70.0060.00714.61
7.3.60.0090.00614.82
7.3.50.0070.00814.81
7.3.40.0030.01014.84
7.3.30.0020.01214.70
7.3.20.0050.00816.68
7.3.10.0090.00516.60
7.3.00.0060.00816.65
7.2.260.0090.00914.88
7.2.250.0090.00914.96
7.2.240.0070.01214.99
7.2.230.0030.01314.91
7.2.220.0060.00814.94
7.2.210.0100.00415.08
7.2.200.0070.00615.09
7.2.190.0030.01214.91
7.2.180.0050.00815.08
7.2.170.0080.00615.03
7.2.160.0120.00315.11
7.2.150.0000.00916.95
7.2.140.0070.00717.02
7.2.130.0070.00816.91
7.2.120.0110.00316.97
7.2.110.0060.01316.93
7.2.100.0080.01016.78
7.2.90.0050.00916.57
7.2.80.0080.00616.74
7.2.70.0010.01416.56
7.2.60.0030.01316.93
7.2.50.0070.00716.71
7.2.40.0090.00916.79
7.2.30.0150.00216.82
7.2.20.0110.00816.92
7.2.10.0120.00516.88
7.2.00.0020.01316.96
7.1.330.0070.00715.89
7.1.320.0010.01215.67
7.1.310.0070.00715.72
7.1.300.0060.00815.68
7.1.290.0070.00615.70
7.1.280.0060.00615.81
7.1.270.0060.01015.76
7.1.260.0040.00815.72
7.1.250.0100.00815.59
7.1.240.0000.01116.04
7.1.230.0090.00315.80
7.1.220.0040.00715.83
7.1.210.0040.01015.85
7.1.200.0060.00615.77
7.1.190.0040.01115.84
7.1.180.0070.01015.81
7.1.170.0110.00015.95
7.1.160.0080.00015.82
7.1.150.0060.00615.91
7.1.140.0030.01215.57
7.1.130.0060.00915.89
7.1.120.0080.00415.59
7.1.110.0030.00815.70
7.1.100.0070.00315.98
7.1.90.0090.00615.57
7.1.80.0070.00715.68
7.1.70.0020.00716.54
7.1.60.0080.00616.64
7.1.50.0100.01225.42
7.1.40.0030.00715.96
7.1.30.0030.01015.85
7.1.20.0070.00315.80
7.1.10.0060.00915.68
7.1.00.0060.04018.99
7.0.330.0040.00715.19
7.0.320.0030.01315.43
7.0.310.0100.00315.25
7.0.300.0040.00415.44
7.0.290.0040.00815.54
7.0.280.0060.00615.25
7.0.270.0070.00315.33
7.0.260.0030.01015.54
7.0.250.0070.00715.33
7.0.240.0120.00015.48
7.0.230.0030.01015.34
7.0.220.0000.01115.61
7.0.210.0080.00315.44
7.0.200.0050.01116.14
7.0.190.0030.01015.56
7.0.180.0070.00315.26
7.0.170.0070.00715.48
7.0.160.0070.00715.36
7.0.150.0070.00715.51
7.0.140.0050.03918.82
7.0.130.0060.01015.51
7.0.120.0100.00715.64
7.0.110.0000.01515.38
7.0.100.0060.00615.53
7.0.90.0040.00815.27
7.0.80.0040.01115.53
7.0.70.2520.02517.61
7.0.60.0070.03317.62
7.0.50.0140.03516.64
7.0.40.0050.04816.69
7.0.30.0280.03016.88
7.0.20.0200.02716.67
7.0.10.0100.04616.85
7.0.00.0050.05016.81
5.6.400.0130.00014.29
5.6.390.0080.00814.71
5.6.380.0030.01314.17
5.6.370.0040.00414.39
5.6.360.0070.00414.81
5.6.350.0030.01014.29
5.6.340.0040.00714.04
5.6.330.0110.00314.46
5.6.320.0100.00314.61
5.6.310.0070.00314.47
5.6.300.0090.00614.15
5.6.290.0060.00614.66
5.6.280.0050.04217.56
5.6.270.0030.01414.25
5.6.260.0090.00914.43
5.6.250.0080.00014.82
5.6.240.0070.00714.35
5.6.230.0060.00614.32
5.6.220.0070.01014.63
5.6.210.0080.04317.57
5.6.200.0070.03216.21
5.6.190.0020.03517.43
5.6.180.0100.02317.46
5.6.170.0130.02217.47
5.6.160.0080.02817.39
5.6.150.0050.04616.21
5.6.140.0120.01816.13
5.6.130.0080.03616.44
5.6.120.0050.04717.63
5.6.110.0060.04817.69
5.6.100.0040.02617.71
5.6.90.0120.04117.67
5.6.80.0030.04317.54
5.6.70.0030.02017.36
5.6.60.0000.01414.06
5.6.50.0030.01014.32
5.6.40.0000.01214.35
5.6.30.0000.01514.32
5.6.20.0070.01014.61
5.6.10.0070.00714.34
5.6.00.0030.00514.13
5.5.380.0060.00914.73
5.5.370.0070.00714.55
5.5.360.0090.00614.46
5.5.350.0060.03317.29
5.5.340.0050.04516.17
5.5.330.0080.04317.39
5.5.320.0090.02017.38
5.5.310.0170.04017.46
5.5.300.0050.02516.28
5.5.290.0050.02816.02
5.5.280.0030.04617.47
5.5.270.0080.04217.56
5.5.260.0050.04717.69
5.5.250.0070.04517.51
5.5.240.0070.04117.23
5.5.230.0030.00814.25
5.5.220.0040.01114.36
5.5.210.0100.00314.52
5.5.200.0000.01414.13
5.5.190.0030.01014.18
5.5.180.0030.00914.12
5.5.170.0070.00714.13
5.5.160.0070.00414.41
5.5.150.0080.00614.20
5.5.140.0000.01314.19
5.5.130.0000.00914.33
5.5.120.0080.00414.44
5.5.110.0030.00914.37
5.5.100.0000.01014.46
5.5.90.0040.00414.36
5.5.80.0000.00914.48
5.5.70.0060.00914.69
5.5.60.0070.00714.45
5.5.50.0000.01314.47
5.5.40.0070.00714.24
5.5.30.0110.00414.48
5.5.20.0040.00414.22
5.5.10.0140.00014.24
5.5.00.0110.00314.42
5.4.450.1600.02216.03
5.4.440.1620.02516.07
5.4.430.1560.02315.95
5.4.420.1750.02015.96
5.4.410.2080.01815.92
5.4.400.1650.02315.91
5.4.390.1630.02515.82
5.4.380.1780.02315.81
5.4.370.1840.02015.91
5.4.360.2050.02115.77
5.4.350.1970.02215.83
5.4.340.1750.02015.86
5.4.330.0030.00612.57
5.4.320.1780.02115.83
5.4.310.2080.02015.87
5.4.300.1900.02515.81
5.4.290.1980.02415.81
5.4.280.2130.02215.71
5.4.270.1840.02015.87
5.4.260.1950.02315.86
5.4.250.2120.01815.82
5.4.240.1920.02415.72
5.4.230.1680.02115.90
5.4.220.1770.02015.73
5.4.210.1780.02015.86
5.4.200.1620.02315.80
5.4.190.1630.02215.87
5.4.180.1820.02115.78
5.4.170.2080.02115.82
5.4.160.1750.02215.77
5.4.150.1630.02815.85
5.4.140.1670.02114.34
5.4.130.1660.02314.50
5.4.120.1730.02014.49
5.4.110.1680.01814.52
5.4.100.1430.01814.41
5.4.90.1410.02614.44
5.4.80.1590.02014.35
5.4.70.1880.02414.56
5.4.60.1280.02114.34
5.4.50.1420.02514.33
5.4.40.1510.01814.46
5.4.30.1600.02014.51
5.4.20.1480.01614.45
5.4.10.1680.01814.52
5.4.00.1640.01814.19
5.3.290.3370.03714.61
5.3.280.3430.04014.55
5.3.270.4100.04014.56
5.3.260.3670.03714.70
5.3.250.3370.03314.58
5.3.240.2400.04014.50
5.3.230.3270.03314.53
5.3.220.3400.04014.51
5.3.210.3270.03714.47
5.3.200.3330.03314.53
5.3.190.2070.03714.54
5.3.180.2400.03714.49
5.3.170.2530.03014.49
5.3.160.2630.04014.36
5.3.150.2700.03714.44
5.3.140.2900.04314.44
5.3.130.3200.04014.48
5.3.120.3600.03714.49
5.3.110.2900.03714.34
5.3.100.3600.03713.98
5.3.90.3530.03713.92
5.3.80.3430.04313.96
5.3.70.3500.04013.99
5.3.60.3630.04013.95
5.3.50.3870.03314.04
5.3.40.3930.03313.74
5.3.30.3270.03013.82
5.3.20.3500.03313.48
5.3.10.4000.03313.75
5.3.00.4130.04013.60
5.2.170.3730.03311.16
5.2.160.3370.03711.10
5.2.150.2770.03311.09
5.2.140.2900.03711.11
5.2.130.2700.03011.04
5.2.120.3400.03011.19
5.2.110.3600.02711.04
5.2.100.3230.02711.09
5.2.90.3500.03011.00
5.2.80.3430.03311.04
5.2.70.3330.03011.09
5.2.60.3470.02311.05
5.2.50.3500.02311.17
5.2.40.2800.03010.82
5.2.30.2700.02310.97
5.2.20.2430.03010.78
5.2.10.2470.03310.86
5.2.00.2200.03310.71
5.1.60.2470.02710.15
5.1.50.2130.02710.08
5.1.40.2230.0209.95
5.1.30.2700.02710.34
5.1.20.2930.02310.35
5.1.10.2900.02710.15
5.1.00.3670.02310.04
5.0.50.1630.0208.48
5.0.40.1570.0238.34
5.0.30.1630.0278.23
5.0.20.1570.0208.27
5.0.10.1430.0208.32
5.0.00.1530.0278.23
4.4.90.1330.0176.07
4.4.80.1630.0206.07
4.4.70.1330.0206.07
4.4.60.1300.0136.07
4.4.50.1270.0236.07
4.4.40.1430.0236.07
4.4.30.1370.0176.07
4.4.20.1600.0206.07
4.4.10.1470.0236.07
4.4.00.1370.0176.07
4.3.110.1570.0136.07
4.3.100.1230.0176.07
4.3.90.1270.0176.07
4.3.80.1330.0306.07
4.3.70.1170.0136.07
4.3.60.1270.0136.07
4.3.50.1270.0176.07
4.3.40.1300.0306.07
4.3.30.0600.0236.07
4.3.20.0730.0276.07
4.3.10.0700.0276.07
4.3.00.0430.0276.07

preferences:
37.24 ms | 400 KiB | 5 Q