3v4l.org

run code in 300+ PHP versions simultaneously
<?php $products = [1, 2, 3, 4, 5]; $vendors = ["Amazon", "Newegg", "##php"]; // Super complex price calculator function getPrice($vendor, $product) { return rand(0, 100); } $productsCalculated = []; $chosenVendors = []; foreach ($products as $productID) { $prices = []; foreach ($vendors as $vendor) { $prices[$vendor] = getPrice($vendor, $productID); } asort($prices); // Save this for debugging $productsCalculated[$productID] = $prices; // Retreive the first item of the array as it should be lowest reset($prices); $chosenVendor = key($prices); $chosenVendors[$chosenVendor][] = $productID; } var_dump($chosenVendors);

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.0110.00716.00
7.4.00.0050.01015.49
7.3.130.0060.01316.00
7.3.120.0050.01415.41
7.3.110.0040.01415.34
7.3.100.0080.00715.29
7.3.90.0070.00715.42
7.3.80.0070.00815.43
7.3.70.0080.00515.42
7.3.60.0060.00715.39
7.3.50.0020.01215.25
7.3.40.0100.00215.33
7.3.30.0070.00815.41
7.3.20.0030.01216.78
7.3.10.0020.00816.62
7.3.00.0080.00516.64
7.2.260.0100.00716.00
7.2.250.0060.01215.50
7.2.240.0020.01515.53
7.2.230.0030.01115.48
7.2.220.0060.00915.51
7.2.210.0090.00615.60
7.2.200.0090.00615.55
7.2.190.0060.00515.52
7.2.180.0090.00515.58
7.2.170.0030.01415.57
7.2.160.0030.00616.00
7.2.150.0100.00316.90
7.2.140.0090.00616.95
7.2.130.0040.00716.93
7.2.120.0050.00516.94
7.2.110.0040.00816.94
7.2.100.0070.01016.69
7.2.90.0070.01017.05
7.2.80.0030.01216.90
7.2.70.0030.00916.82
7.2.60.0040.00717.05
7.2.50.0120.00317.07
7.2.40.0070.00716.64
7.2.30.0070.01016.86
7.2.20.0100.00716.75
7.2.10.0090.00616.77
7.2.00.0040.00718.20
7.1.330.0070.00715.97
7.1.320.0060.00815.82
7.1.310.0040.00815.85
7.1.300.0050.00715.88
7.1.290.0050.01015.88
7.1.280.0050.00815.92
7.1.270.0020.01015.91
7.1.260.0050.00715.93
7.1.250.0030.00916.00
7.1.240.0000.01116.00
7.1.230.0030.00616.00
7.1.220.0080.00816.00
7.1.210.0080.00416.00
7.1.200.0130.00316.00
7.1.190.0070.00716.00
7.1.180.0070.00716.00
7.1.170.0060.00916.00
7.1.160.0060.00916.00
7.1.150.0030.01016.00
7.1.140.0100.00316.00
7.1.130.0090.00616.00
7.1.120.0120.00316.00
7.1.110.0100.00316.00
7.1.100.0000.01416.00
7.1.90.0060.00916.00
7.1.80.0090.00316.00
7.1.70.0070.00316.62
7.1.60.0050.00816.66
7.1.50.0070.01316.53
7.1.40.0090.00616.00
7.1.30.0070.00716.00
7.1.20.0080.00416.00
7.1.10.0070.01016.00
7.1.00.0060.03819.15
7.0.330.0070.01016.00
7.0.320.0000.01516.00
7.0.310.0100.00316.00
7.0.300.0060.00616.00
7.0.290.0090.00316.00
7.0.280.0040.01116.00
7.0.270.0000.01216.00
7.0.260.0030.00916.00
7.0.250.0030.01316.00
7.0.240.0080.00816.00
7.0.230.0030.01316.00
7.0.220.0090.00316.00
7.0.210.0080.00316.00
7.0.200.0080.00716.41
7.0.190.0070.00316.00
7.0.180.0030.00916.00
7.0.170.0130.00016.00
7.0.160.0000.00816.00
7.0.150.0040.01216.00
7.0.140.0060.04019.05
7.0.130.0070.00716.00
7.0.120.0080.00616.00
7.0.110.0040.00716.00
7.0.100.0120.03817.91
7.0.90.0070.03917.91
7.0.80.0090.04317.94
7.0.70.0050.04517.91
7.0.60.0070.04518.02
7.0.50.0290.04318.17
7.0.40.0050.04218.00
7.0.30.0110.03218.00
7.0.20.0070.04318.02
7.0.10.0020.05118.08
7.0.00.0050.04518.08
5.6.400.0030.00616.00
5.6.390.0030.01016.00
5.6.380.0060.00616.00
5.6.370.0080.00816.00
5.6.360.0090.00316.00
5.6.350.0070.00716.00
5.6.340.0030.00616.00
5.6.330.0060.00616.00
5.6.320.0110.00016.00
5.6.310.0030.00916.00
5.6.300.0100.00316.00
5.6.290.0060.00616.00
5.6.280.0110.03518.54
5.6.270.0040.00816.00
5.6.260.0070.00716.00
5.6.250.0090.04618.34
5.6.240.0050.03218.28
5.6.230.0130.03518.37
5.6.220.0120.04218.24
5.6.210.0080.03018.36
5.6.200.0090.04718.52
5.6.190.0070.04818.47
5.6.180.0080.04018.56
5.6.170.0080.04318.53
5.6.160.0100.02318.53
5.6.150.0020.05018.59
5.6.140.0070.04018.55
5.6.130.0120.04218.58
5.6.120.0050.05318.47
5.6.110.0030.03918.47
5.6.100.0110.03718.50
5.6.90.0070.04618.44
5.6.80.0110.03518.29
5.6.70.0060.04418.17
5.6.60.0080.04318.19
5.6.50.0110.04018.23
5.6.40.0100.04318.19
5.6.30.0090.04218.16
5.6.20.0030.04318.23
5.6.10.0130.03818.26
5.6.00.0060.02718.21
5.5.380.0030.04518.16
5.5.370.0070.03818.23
5.5.360.0120.04218.20
5.5.350.0070.04718.16
5.5.340.0070.04118.43
5.5.330.0050.04718.32
5.5.320.0070.04418.37
5.5.310.0050.04818.40
5.5.300.0060.04318.32
5.5.290.0080.04718.39
5.5.280.0090.04418.41
5.5.270.0080.03818.36
5.5.260.0020.04918.44
5.5.250.0040.03718.31
5.5.240.0070.04218.12
5.5.230.0170.02918.13
5.5.220.0030.04718.07
5.5.210.0100.04318.14
5.5.200.0050.04218.14
5.5.190.0080.04118.14
5.5.180.0050.04318.04
5.5.170.0090.00616.00
5.5.160.0100.03018.11
5.5.150.0080.04118.06
5.5.140.0160.03318.04
5.5.130.0080.04018.13
5.5.120.0070.04518.14
5.5.110.0050.04118.13
5.5.100.0050.04918.04
5.5.90.0120.04018.03
5.5.80.0050.04518.09
5.5.70.0070.03818.03
5.5.60.0000.04918.08
5.5.50.0140.03417.95
5.5.40.0100.04018.00
5.5.30.0080.04117.96
5.5.20.0100.04318.04
5.5.10.0070.04118.00
5.5.00.0050.04718.03
5.4.450.0060.04517.68
5.4.440.0070.03917.63
5.4.430.0090.02717.68
5.4.420.0150.03517.72
5.4.410.0080.04117.66
5.4.400.0070.04017.45
5.4.390.0070.02517.52
5.4.380.0050.03817.61
5.4.370.0030.03517.52
5.4.360.0070.04717.52
5.4.350.0070.03817.44
5.4.340.0090.03717.58
5.4.330.0050.00816.00
5.4.320.0110.03617.43
5.4.310.0100.03717.60
5.4.300.0090.03517.54
5.4.290.0050.04017.57
5.4.280.0050.03917.43
5.4.270.0030.04017.60
5.4.260.0100.04017.56
5.4.250.0050.04217.51
5.4.240.0070.04117.51
5.4.230.0050.04417.58
5.4.220.0050.04417.59
5.4.210.0100.03817.51
5.4.200.0020.04517.60
5.4.190.0050.03917.55
5.4.180.0060.04217.42
5.4.170.0040.03917.42
5.4.160.0070.03617.43
5.4.150.0030.04117.55
5.4.140.0050.03716.21
5.4.130.0060.03616.09
5.4.120.0070.03416.15
5.4.110.0090.03916.16
5.4.100.0090.03716.19
5.4.90.0080.03916.16
5.4.80.0060.03616.21
5.4.70.0050.04016.22
5.4.60.0020.04216.20
5.4.50.0030.04116.24
5.4.40.0080.02116.27
5.4.30.0090.03516.12
5.4.20.0080.03916.19
5.4.10.0040.03616.19
5.4.00.0020.04315.89
5.3.290.0100.03815.31
5.3.280.0090.03715.29
5.3.270.0050.04215.28
5.3.260.0050.04215.30
5.3.250.0050.02915.30
5.3.240.0060.04215.23
5.3.230.0020.04315.30
5.3.220.0070.03715.26
5.3.210.0090.03715.26
5.3.200.0050.02415.27
5.3.190.0070.02515.20
5.3.180.0070.04215.28
5.3.170.0060.02115.21
5.3.160.0110.02815.22
5.3.150.0030.03615.28
5.3.140.0020.03115.27
5.3.130.0100.04015.27
5.3.120.0080.03115.21
5.3.110.0050.03015.25
5.3.100.0020.04514.95
5.3.90.0100.03514.99
5.3.80.0060.03614.94
5.3.70.0130.02815.00
5.3.60.0030.04414.89
5.3.50.0030.03714.97
5.3.40.0050.04014.87
5.3.30.0050.04014.94
5.3.20.0060.03514.83
5.3.10.0030.04214.81
5.3.00.0020.03714.70
5.2.170.0000.07011.18
5.2.160.0070.06011.09
5.2.150.0030.03711.21
5.2.140.0070.06310.99
5.2.130.0030.06011.06
5.2.120.0100.05711.09
5.2.110.0030.06311.17
5.2.100.0030.06311.09
5.2.90.0030.06311.10
5.2.80.0130.05311.05
5.2.70.0070.06010.92
5.2.60.0030.06711.04
5.2.50.0070.06310.89
5.2.40.0100.04711.06
5.2.30.0070.03710.77
5.2.20.0030.06011.02
5.2.10.0000.06310.90
5.2.00.0030.06010.67
5.1.60.0030.05310.53
5.1.50.0070.04710.53
5.1.40.0100.05010.53
5.1.30.0030.06010.53
5.1.20.0100.05010.53
5.1.10.0070.05310.53
5.1.00.0030.03710.53
5.0.50.0070.03310.53
5.0.40.0000.04710.53
5.0.30.0000.06710.53
5.0.20.0000.04710.53
5.0.10.0030.04310.53
5.0.00.0000.06310.53
4.4.90.0030.03010.53
4.4.80.0000.03310.53
4.4.70.0000.02310.53
4.4.60.0030.03310.53
4.4.50.0030.03710.53
4.4.40.0000.05010.53
4.4.30.0030.03310.53
4.4.20.0030.03310.53
4.4.10.0000.03710.53
4.4.00.0070.04310.53
4.3.110.0030.03710.53
4.3.100.0070.01710.53
4.3.90.0030.03310.53
4.3.80.0000.05710.53
4.3.70.0030.02310.53
4.3.60.0070.02710.53
4.3.50.0030.03310.53
4.3.40.0070.04710.53
4.3.30.0070.03310.53
4.3.20.0000.03310.53
4.3.10.0000.03010.53
4.3.00.0030.03010.53

preferences:
37.54 ms | 400 KiB | 5 Q