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; } print "Cheapest prices\n"; var_dump($chosenVendors); print "All prices\n"; var_dump($productsCalculated);

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.00714.66
7.4.00.0040.01515.20
7.3.130.0100.00614.92
7.3.120.0100.00714.71
7.3.110.0070.01315.14
7.3.100.0100.00714.92
7.3.90.0060.00914.91
7.3.80.0070.00715.13
7.3.70.0000.01414.69
7.3.60.0000.01414.87
7.3.50.0030.01014.58
7.3.40.0060.01014.86
7.3.30.0110.00414.94
7.3.20.0030.01316.86
7.3.10.0030.01216.80
7.3.00.0100.00316.76
7.2.260.0060.01215.10
7.2.250.0030.01415.27
7.2.240.0030.01015.27
7.2.230.0070.00714.96
7.2.220.0130.00315.27
7.2.210.0060.00915.29
7.2.200.0030.01015.26
7.2.190.0000.01414.82
7.2.180.0060.01015.11
7.2.170.0090.00615.16
7.2.160.0090.00615.14
7.2.150.0060.00916.75
7.2.140.0000.01217.09
7.2.130.0080.00816.84
7.2.120.0000.01217.02
7.2.110.0100.00017.03
7.2.100.0040.00816.81
7.2.90.0040.01117.08
7.2.80.0070.00717.06
7.2.70.0030.00616.99
7.2.60.0080.00817.02
7.2.50.0030.01217.04
7.2.40.0090.00317.14
7.2.30.0070.00717.10
7.2.20.0070.00717.18
7.2.10.0040.01517.07
7.2.00.0080.00518.26
7.1.330.0090.00615.82
7.1.320.0040.01515.59
7.1.310.0080.00515.71
7.1.300.0000.01516.05
7.1.290.0000.01815.77
7.1.280.0060.00815.93
7.1.270.0040.01115.89
7.1.260.0070.00315.77
7.1.250.0080.00316.00
7.1.240.0100.00315.63
7.1.230.0030.00615.75
7.1.220.0040.01115.79
7.1.210.0000.00915.71
7.1.200.0060.00915.63
7.1.190.0120.00015.68
7.1.180.0070.00715.86
7.1.170.0000.01215.65
7.1.160.0040.00815.72
7.1.150.0090.00615.55
7.1.140.0040.00715.86
7.1.130.0000.01215.98
7.1.120.0060.00315.72
7.1.110.0080.00815.78
7.1.100.0060.00915.52
7.1.90.0090.00615.96
7.1.80.0030.00915.94
7.1.70.0040.00716.34
7.1.60.0070.01317.53
7.1.50.0030.01516.53
7.1.40.0030.00815.75
7.1.30.0040.00715.98
7.1.20.0070.00315.91
7.1.10.0070.01015.82
7.1.00.0040.01919.18
7.0.330.0030.00915.35
7.0.320.0040.00715.16
7.0.310.0060.00915.33
7.0.300.0080.00815.46
7.0.290.0120.00015.51
7.0.280.0040.00815.04
7.0.270.0070.00715.45
7.0.260.0040.00815.09
7.0.250.0110.00415.57
7.0.240.0050.00815.24
7.0.230.0120.00015.41
7.0.220.0090.00315.31
7.0.210.0130.00015.58
7.0.200.0040.00915.94
7.0.190.0000.01515.57
7.0.180.0080.00015.23
7.0.170.0060.00915.41
7.0.160.0030.01015.46
7.0.150.0110.00415.45
7.0.140.0050.03818.75
7.0.130.0000.01515.51
7.0.120.0120.00315.17
7.0.110.0060.00915.55
7.0.100.0050.02117.75
7.0.90.0070.02417.71
7.0.80.0090.02017.61
7.0.70.0050.02817.59
7.0.60.0120.02517.67
7.0.50.0030.02817.94
7.0.40.0050.02216.75
7.0.30.0060.02516.65
7.0.20.0050.02316.67
7.0.10.0050.01816.69
7.0.00.0030.02616.76
5.6.400.0060.01014.41
5.6.390.0030.01014.06
5.6.380.0000.01414.40
5.6.370.0060.00614.72
5.6.360.0130.00314.28
5.6.350.0000.01214.46
5.6.340.0060.00914.73
5.6.330.0070.00714.43
5.6.320.0000.01814.18
5.6.310.0030.01014.38
5.6.300.0070.00714.30
5.6.290.0070.00414.31
5.6.280.0060.03917.52
5.6.270.0060.00914.58
5.6.260.0100.00614.24
5.6.250.0070.02217.52
5.6.240.0020.02817.60
5.6.230.0020.03017.59
5.6.220.0020.03117.63
5.6.210.0030.02317.56
5.6.200.0060.02517.62
5.6.190.0070.02217.69
5.6.180.0060.02917.73
5.6.170.0080.02117.82
5.6.160.0060.03617.70
5.6.150.0070.04517.86
5.6.140.0060.02617.75
5.6.130.0090.04817.81
5.6.120.0050.02717.67
5.6.110.0070.03217.52
5.6.100.0120.04017.75
5.6.90.0060.04617.66
5.6.80.0050.03317.28
5.6.70.0050.04517.33
5.6.60.0070.04517.34
5.6.50.0030.04817.47
5.6.40.0080.03717.35
5.6.30.0110.04117.39
5.6.20.0050.03517.30
5.6.10.0070.03517.33
5.6.00.0080.04617.39
5.5.380.0080.02617.35
5.5.370.0050.02517.40
5.5.360.0070.02417.29
5.5.350.0120.01817.31
5.5.340.0050.02517.63
5.5.330.0080.01817.75
5.5.320.0060.02717.61
5.5.310.0050.02717.72
5.5.300.0100.02217.55
5.5.290.0100.04217.45
5.5.280.0070.04417.53
5.5.270.0090.02717.38
5.5.260.0050.03217.56
5.5.250.0050.03617.38
5.5.240.0150.03117.27
5.5.230.0080.04617.13
5.5.220.0120.03917.36
5.5.210.0130.01817.34
5.5.200.0050.04417.28
5.5.190.0030.02817.12
5.5.180.0060.02617.28
5.5.170.0030.01014.39
5.5.160.0120.03517.04
5.5.150.0080.03817.34
5.5.140.0030.04717.24
5.5.130.0080.03317.28
5.5.120.0120.04217.16
5.5.110.0050.04017.36
5.5.100.0080.04317.33
5.5.90.0060.02817.19
5.5.80.0100.03917.07
5.5.70.0060.04017.19
5.5.60.0090.03217.03
5.5.50.0100.03717.09
5.5.40.0090.04417.05
5.5.30.0100.03917.20
5.5.20.0130.02317.13
5.5.10.0100.03217.21
5.5.00.0030.03717.04
5.4.450.0020.02815.37
5.4.440.0030.04715.26
5.4.430.0030.04415.36
5.4.420.0020.03115.21
5.4.410.0030.04015.18
5.4.400.0050.04415.17
5.4.390.0050.04115.19
5.4.380.0030.03915.10
5.4.370.0070.04115.12
5.4.360.0070.04215.19
5.4.350.0050.04515.10
5.4.340.0080.03815.05
5.4.330.0040.00411.25
5.4.320.0020.04115.20
5.4.310.0030.03015.06
5.4.300.0050.02615.24
5.4.290.0050.03815.05
5.4.280.0030.03515.14
5.4.270.0050.02715.19
5.4.260.0030.04215.14
5.4.250.0030.04615.20
5.4.240.0030.04015.07
5.4.230.0110.03115.24
5.4.220.0030.04215.13
5.4.210.0090.03515.17
5.4.200.0040.03015.21
5.4.190.0110.03815.14
5.4.180.0060.03615.06
5.4.170.0060.02315.13
5.4.160.0060.02615.14
5.4.150.0030.02315.07
5.4.140.0070.03813.75
5.4.130.0070.02113.75
5.4.120.0020.02713.83
5.4.110.0090.03413.88
5.4.100.0050.03513.87
5.4.90.0050.03813.81
5.4.80.0070.01813.86
5.4.70.0110.01713.85
5.4.60.0050.04013.82
5.4.50.0030.03013.79
5.4.40.0080.03013.87
5.4.30.0070.02713.89
5.4.20.0070.02713.80
5.4.10.0050.03813.78
5.4.00.0070.03713.58
5.3.290.0070.03212.96
5.3.280.0100.03012.93
5.3.270.0010.04112.93
5.3.260.0040.02912.86
5.3.250.0050.02412.88
5.3.240.0080.03312.86
5.3.230.0070.02212.84
5.3.220.0040.03912.86
5.3.210.0050.04212.90
5.3.200.0040.04212.84
5.3.190.0030.02512.89
5.3.180.0070.02512.82
5.3.170.0020.02712.89
5.3.160.0050.03612.89
5.3.150.0030.02112.89
5.3.140.0030.03512.88
5.3.130.0050.03612.83
5.3.120.0060.03112.88
5.3.110.0030.03812.88
5.3.100.0000.04312.62
5.3.90.0030.04212.63
5.3.80.0030.02912.52
5.3.70.0040.04212.51
5.3.60.0060.03812.51
5.3.50.0090.03312.53
5.3.40.0030.02512.55
5.3.30.0030.02512.51
5.3.20.0050.02112.46
5.3.10.0050.03312.34
5.3.00.0070.03512.32
5.2.170.0030.06711.13
5.2.160.0030.07011.13
5.2.150.0030.05010.99
5.2.140.0070.06011.13
5.2.130.0030.06011.17
5.2.120.0000.04011.09
5.2.110.0100.05710.89
5.2.100.0030.04311.09
5.2.90.0130.04710.95
5.2.80.0030.05011.01
5.2.70.0030.03010.91
5.2.60.0030.05710.88
5.2.50.0000.04011.05
5.2.40.0070.05310.83
5.2.30.0030.05710.82
5.2.20.0000.03010.75
5.2.10.0070.04310.82
5.2.00.0030.06010.66
5.1.60.0100.05010.02
5.1.50.0030.0439.99
5.1.40.0070.05310.04
5.1.30.0030.06010.41
5.1.20.0100.02310.30
5.1.10.0100.03710.09
5.1.00.0030.03310.06
5.0.50.0070.0409.24
5.0.40.0000.0409.24
5.0.30.0000.0379.24
5.0.20.0070.0309.24
5.0.10.0000.0309.24
5.0.00.0070.0579.24
4.4.90.0000.0309.24
4.4.80.0030.0179.24
4.4.70.0030.0309.24
4.4.60.0030.0379.24
4.4.50.0000.0239.24
4.4.40.0000.0579.24
4.4.30.0000.0239.24
4.4.20.0000.0279.24
4.4.10.0100.0179.24
4.4.00.0070.0539.24
4.3.110.0030.0339.24
4.3.100.0000.0379.24
4.3.90.0030.0279.24
4.3.80.0070.0409.24
4.3.70.0030.0339.24
4.3.60.0000.0279.24
4.3.50.0000.0339.24
4.3.40.0000.0409.24
4.3.30.0000.0179.24
4.3.20.0030.0279.24
4.3.10.0000.0239.24
4.3.00.0030.0309.24

preferences:
35.97 ms | 401 KiB | 5 Q