3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calculateRoutes($points){ //our output array $out = array(); //reset the index of our points to ensure they are 0 to N-1 $points = array_values($points); //loop over the points once for($i=0; $i<count($points) - 1; $i++){ //loop over the points again, offset by 1 for($j=$i+1; $j<count($points); $j++){ //add to our output array the two points $out[] = array($points[$i], $points[$j]); } } //return the final result return $out; } $points = array('A', 'B', 'C', 'D'); $routes = calculateRoutes($points); print_r($routes);

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)
8.4.120.0120.00920.59
8.4.110.0050.00522.50
8.4.100.0100.01017.71
8.4.90.0040.00518.54
8.4.80.0020.00617.67
8.4.70.0150.00618.00
8.4.60.0050.00618.66
8.4.50.0140.00619.60
8.4.40.0130.00617.80
8.4.30.0140.00717.42
8.4.20.0130.00317.60
8.4.10.0040.01219.22
8.3.250.0130.00518.83
8.3.240.0110.00817.16
8.3.230.0120.00616.55
8.3.220.0030.00517.09
8.3.210.0090.01016.76
8.3.200.0070.00116.69
8.3.190.0120.00617.27
8.3.180.0110.00816.46
8.3.170.0120.00618.90
8.3.160.0130.00316.43
8.3.150.0180.00019.16
8.3.140.0070.01116.50
8.3.130.0050.00518.56
8.3.120.0150.00020.80
8.3.110.0080.00816.59
8.3.100.0040.00420.36
8.3.90.0110.00326.77
8.3.80.0060.00319.36
8.3.70.0110.00716.63
8.3.60.0070.01418.43
8.3.50.0110.01122.81
8.3.40.0070.00718.67
8.3.30.0090.01218.50
8.3.20.0000.00721.73
8.3.10.0050.00322.04
8.3.00.0050.00319.84
8.2.290.0110.00820.39
8.2.280.0050.00418.36
8.2.270.0070.01117.59
8.2.260.0060.00316.59
8.2.250.0040.00418.26
8.2.240.0050.00318.88
8.2.230.0060.00320.94
8.2.220.0090.00024.06
8.2.210.0120.00626.77
8.2.200.0030.00618.88
8.2.190.0160.00618.18
8.2.180.0110.00718.54
8.2.170.0110.00422.96
8.2.160.0070.00720.19
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00019.64
8.2.120.0000.00826.35
8.2.110.0030.00720.94
8.2.100.0000.01117.78
8.2.90.0030.00619.08
8.2.80.0050.00317.97
8.2.70.0050.00317.63
8.2.60.0050.00318.05
8.2.50.0080.00018.10
8.2.40.0030.00520.33
8.2.30.0000.00819.43
8.2.20.0000.00718.17
8.2.10.0000.00718.20
8.2.00.0050.00217.80
8.1.330.0110.00821.98
8.1.320.0110.00818.09
8.1.310.0120.00916.59
8.1.300.0090.00018.58
8.1.290.0070.00330.84
8.1.280.0170.00325.92
8.1.270.0000.00824.02
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.97
8.1.230.0040.00717.83
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0030.00617.13
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0070.00018.59
8.1.160.0050.00218.92
8.1.150.0080.00020.27
8.1.140.0000.00819.63
8.1.130.0030.00319.02
8.1.120.0000.00717.46
8.1.110.0080.00017.35
8.1.100.0050.00217.48
8.1.90.0000.00717.52
8.1.80.0000.00717.36
8.1.70.0040.00417.38
8.1.60.0090.00017.54
8.1.50.0040.00417.54
8.1.40.0050.00317.42
8.1.30.0080.00017.64
8.1.20.0000.00717.66
8.1.10.0040.00417.59
8.1.00.0040.00417.48
8.0.300.0040.00418.77
8.0.290.0000.00816.75
8.0.280.0000.00718.45
8.0.270.0070.00017.19
8.0.260.0060.00317.14
8.0.250.0030.00316.95
8.0.240.0040.00416.96
8.0.230.0070.00016.98
8.0.220.0050.00316.86
8.0.210.0070.00016.88
8.0.200.0000.00616.98
8.0.190.0000.00917.00
8.0.180.0040.00416.85
8.0.170.0000.00916.98
8.0.160.0040.00416.91
8.0.150.0040.00416.86
8.0.140.0000.00716.82
8.0.130.0030.00313.29
8.0.120.0000.00716.77
8.0.110.0040.00416.93
8.0.100.0070.00016.75
8.0.90.0000.00716.81
8.0.80.0070.00716.96
8.0.70.0000.00716.70
8.0.60.0000.00716.77
8.0.50.0000.00816.94
8.0.30.0070.01217.03
8.0.20.0110.00817.40
8.0.10.0040.00417.04
8.0.00.0070.01016.59
7.4.330.0070.00015.55
7.4.320.0000.00716.52
7.4.300.0000.00616.55
7.4.290.0020.00516.48
7.4.280.0020.00516.48
7.4.270.0030.00316.57
7.4.260.0030.00716.58
7.4.250.0000.00816.54
7.4.240.0040.00416.59
7.4.230.0000.00716.48
7.4.220.0030.01516.70
7.4.210.0100.00716.62
7.4.200.0030.00316.45
7.4.160.0060.00916.48
7.4.150.0040.01417.40
7.4.140.0120.00617.86
7.4.130.0060.01116.60
7.4.120.0080.01116.53
7.4.110.0060.01016.57
7.4.100.0190.00716.46
7.4.90.0080.00816.36
7.4.80.0100.00719.39
7.4.70.0080.00816.41
7.4.60.0070.01416.39
7.4.50.0030.01316.18
7.4.40.0100.01416.45
7.4.30.0060.01116.20
7.4.10.0030.01714.55
7.4.00.0080.01014.62
7.3.330.0050.00013.29
7.3.320.0050.00013.27
7.3.310.0070.00016.39
7.3.300.0030.00316.32
7.3.290.0070.00016.25
7.3.280.0070.01016.29
7.3.270.0060.01317.40
7.3.260.0140.00516.49
7.3.250.0100.00816.42
7.3.240.0120.00816.48
7.3.230.0100.00716.43
7.3.210.0060.00916.29
7.3.200.0120.00916.36
7.3.190.0090.00916.36
7.3.180.0090.00616.47
7.3.170.0160.00016.63
7.3.160.0100.00716.55
7.3.130.0070.01115.02
7.3.120.0120.00614.91
7.3.110.0030.01714.80
7.3.100.0000.01414.85
7.3.90.0060.00914.57
7.3.80.0070.00714.75
7.3.70.0030.00714.79
7.3.60.0100.00714.77
7.3.50.0040.00814.67
7.3.40.0030.00914.66
7.3.30.0030.00914.83
7.3.20.0060.00316.79
7.3.10.0050.00716.51
7.3.00.0030.01116.69
7.2.330.0100.01016.49
7.2.320.0090.00916.69
7.2.310.0200.00316.46
7.2.300.0160.00816.52
7.2.290.0120.00616.80
7.2.260.0030.01314.68
7.2.250.0100.01014.98
7.2.240.0060.00914.95
7.2.230.0070.01015.10
7.2.220.0090.00914.66
7.2.210.0030.00915.24
7.2.200.0090.00614.73
7.2.190.0100.01014.82
7.2.180.0100.00715.17
7.2.170.0110.00314.86
7.2.160.0000.01215.04
7.2.150.0090.00617.03
7.2.140.0080.00416.63
7.2.130.0050.00916.90
7.2.120.0070.00317.00
7.2.110.0020.01316.56
7.2.100.0060.00817.02
7.2.90.0050.00617.01
7.2.80.0030.01016.98
7.2.70.0040.00916.79
7.2.60.0100.00316.86
7.2.50.0010.01117.02
7.2.40.0060.01016.87
7.2.30.0020.01216.75
7.2.20.0040.01116.92
7.2.10.0050.01016.67
7.2.00.0080.00616.86
7.1.330.0060.00915.58
7.1.320.0120.00315.77
7.1.310.0050.00515.95
7.1.300.0080.00615.80
7.1.290.0070.01015.73
7.1.280.0060.00615.84
7.1.270.0070.00715.75
7.1.260.0030.01015.75
7.1.250.0030.00915.76
7.1.240.0070.00315.52
7.1.230.0110.00315.90
7.1.220.0090.00415.49
7.1.210.0070.00315.78
7.1.200.0060.00615.72
7.1.190.0110.00415.69
7.1.180.0070.00715.43
7.1.170.0060.00915.64
7.1.160.0110.00715.72
7.1.150.0030.00715.61
7.1.140.0060.01215.76
7.1.130.0100.00615.90
7.1.120.0080.00415.68
7.1.110.0060.00615.75
7.1.100.0100.00715.34
7.1.90.0060.00915.84
7.1.80.0040.01115.56
7.1.70.0030.00516.36
7.1.60.0020.01016.61
7.1.50.0050.00515.96
7.1.40.0000.01515.49
7.1.30.0030.00715.49
7.1.20.0100.00315.50
7.1.10.0280.03317.88
7.1.00.0180.04018.20
7.0.330.0000.01015.20
7.0.320.0000.00815.36
7.0.310.0080.00815.31
7.0.300.0110.00815.41
7.0.290.0070.00714.85
7.0.280.0040.01215.38
7.0.270.0030.01515.35
7.0.260.0030.00715.11
7.0.250.0030.00915.22
7.0.240.0060.00915.21
7.0.230.0040.01215.15
7.0.220.0030.01415.14
7.0.210.0040.00815.08
7.0.200.0040.01116.18
7.0.190.0040.01115.15
7.0.180.0030.01315.59
7.0.170.0040.01115.39
7.0.160.0100.00015.41
7.0.150.0300.03017.69
7.0.140.0180.03317.70
7.0.130.0070.03417.66
7.0.120.0230.03417.80
7.0.110.0080.02917.69
7.0.100.0150.03517.76
7.0.90.0110.03017.86
7.0.80.0200.03217.56
7.0.70.0350.03217.64
7.0.60.0230.03017.75
7.0.50.0210.03117.83
7.0.40.0230.03316.83
7.0.30.0180.03116.83
7.0.20.0300.04216.86
7.0.10.0240.02916.89
7.0.00.0170.03716.65
5.6.400.0040.00814.28
5.6.390.0060.00914.65
5.6.380.0030.00914.66
5.6.370.0060.00913.98
5.6.360.0070.00414.43
5.6.350.0000.01014.25
5.6.340.0060.01314.05
5.6.330.0000.01714.63
5.6.320.0160.00014.48
5.6.310.0070.00713.98
5.6.300.0040.01414.71
5.6.290.0100.00314.48
5.6.280.0070.00414.70
5.6.270.0030.01014.41
5.6.260.0080.00814.41
5.6.250.0040.01114.20
5.6.240.0090.00014.60
5.6.230.0070.00714.03
5.6.220.0080.00413.98
5.6.210.0040.00814.07
5.6.200.0070.00714.20
5.6.190.0070.00714.21
5.6.180.0060.00914.41
5.6.170.0000.01514.21
5.6.160.0040.00814.38
5.6.150.0070.00414.25
5.6.140.0060.00314.35
5.6.130.0100.00614.38
5.6.120.0030.00614.10
5.6.110.0090.00313.98
5.6.100.0070.00714.23
5.6.90.0040.01413.84
5.6.80.0030.01014.07
5.6.70.0040.01014.33
5.6.60.0030.01314.46
5.6.50.0090.00314.11
5.6.40.0090.00314.11
5.6.30.0070.00314.11
5.6.20.0070.00714.24
5.6.10.0080.00313.96
5.6.00.0000.00814.04

preferences:
30.27 ms | 403 KiB | 5 Q