3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array("url" => "http://google.com", "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.2.00.0030.01019.46
7.1.70.0030.00717.24
7.1.60.0040.00717.27
7.1.50.0040.00716.69
7.1.40.0110.00016.65
7.1.30.0190.00316.46
7.1.20.0100.00016.65
7.1.10.0000.00716.48
7.1.00.0050.00316.62
7.0.200.0090.00016.87
7.0.190.0040.00416.91
7.0.180.0090.00016.36
7.0.170.0000.00816.48
7.0.160.0050.00516.12
7.0.150.0000.00716.28
7.0.140.0030.00716.36
7.0.130.0030.00616.76
7.0.120.0070.00016.63
7.0.110.0000.00816.27
7.0.100.0030.00716.47
7.0.90.0040.00716.55
7.0.80.0080.00016.53
7.0.70.0000.00816.30
7.0.60.0020.00516.19
7.0.50.0040.00816.32
7.0.40.0040.00415.38
7.0.30.0030.00615.38
7.0.20.0000.00715.38
7.0.10.0030.00715.38
7.0.00.0070.00315.38
5.6.300.0030.04220.99
5.6.290.0070.04420.89
5.6.280.0000.04820.82
5.6.270.0030.04420.93
5.6.260.0000.04320.85
5.6.250.0070.08120.89
5.6.240.0030.04821.05
5.6.230.0070.04120.79
5.6.220.0360.05320.93
5.6.210.0070.03820.59
5.6.200.0040.04620.86
5.6.190.0100.03520.85
5.6.180.0030.04920.86
5.6.170.0030.04020.85
5.6.160.0060.03520.91
5.6.150.0030.04120.82
5.6.140.0060.03920.91
5.6.130.0030.04121.00
5.6.120.0030.04820.91
5.6.110.0070.04120.90
5.6.100.0030.04920.81
5.6.90.0120.03120.84
5.6.80.0000.04420.37
5.6.70.0030.04620.31
5.6.60.0100.03220.36
5.6.50.0000.04720.23
5.6.40.0030.04220.38
5.6.30.0030.04320.17
5.6.20.0160.03220.19
5.6.10.0060.03520.16
5.6.00.0000.04720.28
5.5.380.0070.04017.50
5.5.370.0030.04817.48
5.5.360.0030.04817.49
5.5.350.0030.04317.47
5.5.340.0000.04618.06
5.5.330.0070.04017.74
5.5.320.0030.04117.70
5.5.310.0000.04218.07
5.5.300.0000.04718.01
5.5.290.0210.03218.03
5.5.280.0000.07017.98
5.5.270.0030.04617.94
5.5.260.0000.05517.92
5.5.250.0030.04217.75
5.5.240.0000.05117.25
5.5.230.0030.04117.23
5.5.220.0030.03717.20
5.5.210.0030.07317.42
5.5.200.0030.04017.34
5.5.190.0000.04717.37
5.5.180.0100.04017.21
5.5.160.0030.03517.30
5.5.150.0030.04317.28
5.5.140.0000.04017.28
5.5.130.0030.03717.41
5.5.120.0030.03917.36
5.5.110.0000.04117.36
5.5.100.0030.03717.09
5.5.90.0030.03516.95
5.5.80.0000.05317.20
5.5.70.0030.04017.18
5.5.60.0100.03317.35
5.5.50.0030.06017.18
5.5.40.0000.04016.98
5.5.30.0000.04217.20
5.5.20.0130.04717.20
5.5.10.0070.03316.94
5.5.00.0000.04917.26
5.4.450.0000.05619.33
5.4.440.0030.04319.14
5.4.430.0000.05719.32
5.4.420.0030.04119.38
5.4.410.0060.03519.28
5.4.400.0070.03119.11
5.4.390.0060.03518.82
5.4.380.0100.05219.07
5.4.370.0100.03618.93
5.4.360.0070.03718.97
5.4.350.0320.03618.87
5.4.340.0100.03519.00
5.4.320.0000.04419.13
5.4.310.0000.05919.13
5.4.300.0070.03619.05
5.4.290.0000.04219.02
5.4.280.0100.03818.99
5.4.270.0290.03918.82
5.4.260.0000.04918.97
5.4.250.0070.03518.84
5.4.240.0130.03119.10
5.4.230.0260.03619.04
5.4.220.0070.04918.96
5.4.210.0000.04818.99
5.4.200.0100.03319.00
5.4.190.0000.04118.99
5.4.180.0000.04018.96
5.4.170.0070.07319.04
5.4.160.0030.04218.95
5.4.150.0070.03319.04
5.4.140.0030.04016.59
5.4.130.0070.03116.50
5.4.120.0000.04416.38
5.4.110.0000.03916.40
5.4.100.0000.04416.54
5.4.90.0000.04216.36
5.4.80.0000.03916.59
5.4.70.0100.03116.55
5.4.60.0100.03016.47
5.4.50.0140.04516.54
5.4.40.0060.03916.70
5.4.30.0170.03316.66
5.4.20.0000.04116.65
5.4.10.0030.03916.58
5.4.00.0000.04016.05
5.3.290.0000.03915.38
5.3.280.0030.04415.38
5.3.270.0030.03515.38
5.3.260.0070.03615.38
5.3.250.0000.04615.38
5.3.240.0030.03715.38
5.3.230.0000.03915.38
5.3.220.0000.04815.38
5.3.210.0030.05115.38
5.3.200.0030.03815.38
5.3.190.0000.04115.38
5.3.180.0000.04615.38
5.3.170.0030.04115.38
5.3.160.0130.02815.38
5.3.150.0000.04115.38
5.3.140.0200.04315.38
5.3.130.0300.03015.38
5.3.120.0070.04715.38
5.3.110.0000.04115.38
5.3.100.0400.03015.38
5.3.90.0030.03415.38
5.3.80.0030.04015.38
5.3.70.0070.03315.38
5.3.60.0100.02915.38
5.3.50.0000.03915.38
5.3.40.0000.04015.38
5.3.30.0030.04615.38
5.3.20.0060.03515.38
5.3.10.0000.03915.38
5.3.00.0030.03415.38
5.2.170.0070.03015.38
5.2.160.0040.03215.38
5.2.150.0060.02615.38
5.2.140.0380.01415.38
5.2.130.0000.03215.38
5.2.120.0030.02815.38
5.2.110.0000.03215.38
5.2.100.0000.03115.38
5.2.90.0070.02815.38
5.2.80.0100.02315.38
5.2.70.0070.02815.38
5.2.60.0030.03115.38
5.2.50.0000.03415.38
5.2.40.0030.03015.38
5.2.30.0090.02415.38
5.2.20.0000.03415.38
5.2.10.0070.02815.38
5.2.00.0000.03315.38
5.1.60.0060.02515.38
5.1.50.0030.02515.38
5.1.40.0040.02515.38
5.1.30.0060.02815.38
5.1.20.0350.02215.38
5.1.10.0030.02815.38
5.1.00.0070.02615.38
5.0.50.0030.02015.38
5.0.40.0060.01515.38
5.0.30.0000.03115.38
5.0.20.0000.02115.38
5.0.10.0000.02115.38
5.0.00.0060.02615.38
4.4.90.0000.01915.38
4.4.80.0000.01715.38
4.4.70.0000.01915.38
4.4.60.0060.01015.38
4.4.50.0000.01715.38
4.4.40.0030.02815.38
4.4.30.0000.01715.38
4.4.20.0000.02315.38
4.4.10.0030.01715.38
4.4.00.0000.02515.38
4.3.110.0030.01415.38
4.3.100.0040.01415.38
4.3.90.0000.01815.38
4.3.80.0030.02215.38
4.3.70.0000.01815.38
4.3.60.0000.01615.38
4.3.50.0240.02415.38
4.3.40.0000.02615.38
4.3.30.0070.01115.38
4.3.20.0000.02315.38
4.3.10.0060.01315.38
4.3.00.0030.01815.38

preferences:
36.88 ms | 401 KiB | 5 Q