3v4l.org

run code in 300+ PHP versions simultaneously
<?php function direct_product(array ...$arrays) { $result = [[]]; foreach ($result as $i => $x) { foreach ($arrays as $y) { $result[$i] = array_merge($x, [$y]); } } return $result; } var_export(direct_product(['A', 'B', 'C'], ['a'], [1, 2])); /* array ( 0 => array ( 0 => 'A', 1 => 'a', 2 => 1, ), 1 => array ( 0 => 'A', 1 => 'a', 2 => 2, ), 2 => array ( 0 => 'B', 1 => 'a', 2 => 1, ), 3 => array ( 0 => 'B', 1 => 'a', 2 => 2, ), 4 => array ( 0 => 'C', 1 => 'a', 2 => 1, ), 5 => array ( 0 => 'C', 1 => 'a', 2 => 2, ), ) */ var_export(direct_product(['A', 'B', 'C'], [], [1, 2])); /* array ( ) */

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.3.60.0160.00018.30
8.3.50.0100.00316.59
8.3.40.0060.00918.85
8.3.30.0080.00818.72
8.3.20.0040.00420.23
8.3.10.0040.00423.65
8.3.00.0060.00322.47
8.2.180.0140.00718.31
8.2.170.0060.00922.96
8.2.160.0070.01319.29
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00420.53
8.2.120.0070.00026.35
8.2.110.0070.00422.16
8.2.100.0040.00717.84
8.2.90.0000.00819.17
8.2.80.0050.00318.03
8.2.70.0040.00417.62
8.2.60.0000.00817.93
8.2.50.0000.00819.95
8.2.40.0080.00020.60
8.2.30.0050.00319.37
8.2.20.0040.00418.13
8.2.10.0040.00418.01
8.2.00.0000.00718.31
8.1.280.0180.00325.92
8.1.270.0050.00323.82
8.1.260.0080.00026.35
8.1.250.0150.00328.09
8.1.240.0060.00321.04
8.1.230.0000.01019.22
8.1.220.0050.00317.78
8.1.210.0000.00818.77
8.1.200.0060.00317.25
8.1.190.0000.00917.22
8.1.180.0030.00518.10
8.1.170.0030.00618.71
8.1.160.0040.00418.94
8.1.150.0000.00720.15
8.1.140.0040.00419.59
8.1.130.0040.00418.82
8.1.120.0070.00017.50
8.1.110.0000.00717.39
8.1.100.0040.00417.45
8.1.90.0030.00417.36
8.1.80.0040.00417.50
8.1.70.0040.00417.50
8.1.60.0040.00417.59
8.1.50.0000.00817.38
8.1.40.0060.00317.42
8.1.30.0050.00317.54
8.1.20.0040.00417.63
8.1.10.0080.00017.46
8.1.00.0030.00617.37
8.0.300.0040.00420.16
8.0.290.0040.00416.75
8.0.280.0050.00318.34
8.0.270.0000.00717.31
8.0.260.0060.00018.96
8.0.250.0030.00316.86
8.0.240.0030.00616.84
8.0.230.0000.00816.96
8.0.220.0040.00416.87
8.0.210.0030.00316.98
8.0.200.0090.00316.85
8.0.190.0040.00417.00
8.0.180.0040.00416.81
8.0.170.0040.00416.81
8.0.160.0040.00416.81
8.0.150.0030.00616.79
8.0.140.0000.00716.86
8.0.130.0030.00313.29
8.0.120.0030.00616.88
8.0.110.0040.00416.83
8.0.100.0070.00016.75
8.0.90.0000.00716.86
8.0.80.0090.00616.89
8.0.70.0000.00716.81
8.0.60.0000.00716.95
8.0.50.0070.00016.77
8.0.30.0080.00817.18
8.0.20.0110.00817.40
8.0.10.0040.00416.89
8.0.00.0140.00716.75
7.4.330.0050.00015.55
7.4.320.0070.00016.53
7.4.300.0030.00316.52
7.4.290.0000.00716.55
7.4.280.0000.00816.45
7.4.270.0000.00716.54
7.4.260.0030.00316.59
7.4.250.0000.00816.47
7.4.240.0000.00716.45
7.4.230.0030.00316.67
7.4.220.0120.00616.70
7.4.210.0030.01016.43
7.4.200.0050.00216.63
7.4.160.0090.00916.38
7.4.150.0100.00717.40
7.4.140.0130.01217.86
7.4.130.0100.01716.52
7.4.120.0120.00916.60
7.4.110.0060.01216.27
7.4.100.0100.01316.59
7.4.90.0110.00716.75
7.4.80.0150.00319.39
7.4.70.0130.00716.54
7.4.60.0350.01016.37
7.4.50.0030.00916.32
7.4.40.0130.00316.56
7.4.30.0110.00816.47
7.4.00.0050.01414.96
7.3.330.0000.00513.33
7.3.320.0030.00313.29
7.3.310.0000.00716.20
7.3.300.0030.00316.33
7.3.290.0070.01016.40
7.3.280.0100.00816.31
7.3.270.0210.00417.40
7.3.260.0110.00716.58
7.3.240.0080.01116.49
7.3.230.0030.01316.71
7.3.210.0060.00916.27
7.3.200.0070.01716.30
7.3.190.0090.00916.46
7.3.180.0140.00716.52
7.3.170.0070.01016.39
7.3.160.0110.01116.61
7.3.120.0130.00314.88
7.3.110.0140.00414.89
7.3.100.0060.00615.00
7.3.90.0040.01114.98
7.3.80.0070.00415.04
7.3.70.0060.00614.79
7.3.60.0110.00714.93
7.3.50.0100.00014.80
7.3.40.0120.00614.93
7.3.30.0070.01314.74
7.3.20.0070.01116.86
7.3.10.0080.00616.74
7.3.00.0030.01016.68
7.2.330.0100.00716.68
7.2.320.0070.01016.71
7.2.310.0030.01716.64
7.2.300.0180.00516.63
7.2.290.0080.00816.72
7.2.250.0100.01015.09
7.2.240.0070.01315.14
7.2.230.0130.00315.28
7.2.220.0000.01115.18
7.2.210.0000.00915.22
7.2.200.0130.00614.97
7.2.190.0140.00014.88
7.2.180.0090.00314.92
7.2.170.0070.01015.12
7.2.130.0060.00916.96
7.2.120.0090.00616.95
7.2.110.0030.01316.82
7.2.100.0100.00716.63
7.2.90.0030.00616.98
7.2.80.0040.00916.72
7.2.70.0030.01416.98
7.2.60.0050.00816.68
7.2.50.0040.00716.59
7.2.40.0140.00016.95
7.2.30.0060.00917.06
7.2.20.0050.00516.90
7.2.10.0000.01316.88
7.2.00.0040.01118.03
7.1.330.0070.00715.85
7.1.320.0030.00715.68
7.1.310.0040.01315.95
7.1.300.0060.00615.97
7.1.290.0030.01015.80
7.1.280.0090.01215.60
7.1.270.0030.01015.66
7.1.260.0030.00915.77
7.1.250.0080.00315.79
7.1.200.0060.00615.98
7.1.70.0000.01517.13
7.1.60.0030.00717.19
7.1.50.0330.05740.64
7.1.40.0170.01034.26
7.1.30.0170.01034.26
7.1.20.0130.01734.48
7.1.10.0100.01016.42
7.1.00.0070.01016.62
7.0.200.0090.00616.77
7.0.190.0030.06022.30
7.0.180.0130.00316.09
7.0.170.0030.01016.30
7.0.160.0070.00716.11
7.0.150.0170.00316.19
7.0.140.0100.00716.20
7.0.130.0170.00016.24
7.0.120.0130.00716.38
7.0.110.0130.01016.20
7.0.100.0070.01316.16
7.0.90.0070.01016.39
7.0.80.0070.00716.27
7.0.70.0100.00716.16
7.0.60.0100.00716.22
7.0.50.0100.00716.07
7.0.40.0130.00016.38
7.0.30.0070.00716.57
7.0.20.0070.00316.27
7.0.10.0030.00716.38
7.0.00.0000.01016.51

preferences:
34.58 ms | 400 KiB | 5 Q