3v4l.org

run code in 300+ PHP versions simultaneously
<?php function direct_product(array ...$arrays) { $result = [[]]; foreach ($result as $i => $x) { foreach ($arrays as $j => $y) { $result[$i][$j] = 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.0060.01618.56
8.3.50.0110.00416.40
8.3.40.0070.01418.79
8.3.30.0060.00918.82
8.3.20.0040.00420.30
8.3.10.0040.00421.76
8.3.00.0050.00322.46
8.2.180.0060.00918.54
8.2.170.0030.01122.96
8.2.160.0140.00719.31
8.2.150.0080.00024.18
8.2.140.0000.00724.66
8.2.130.0040.00420.52
8.2.120.0070.00026.35
8.2.110.0070.00322.02
8.2.100.0110.00017.91
8.2.90.0030.00619.40
8.2.80.0000.00817.97
8.2.70.0060.00317.75
8.2.60.0030.00618.03
8.2.50.0040.00418.14
8.2.40.0090.00020.43
8.2.30.0000.00719.31
8.2.20.0050.00318.13
8.2.10.0000.00818.23
8.2.00.0040.00418.13
8.1.280.0090.00625.92
8.1.270.0040.00423.92
8.1.260.0040.00426.35
8.1.250.0070.01128.09
8.1.240.0030.00621.03
8.1.230.0070.00419.12
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0040.00417.47
8.1.190.0000.00817.23
8.1.180.0000.00918.10
8.1.170.0050.00318.51
8.1.160.0000.00718.95
8.1.150.0040.00420.15
8.1.140.0050.00219.50
8.1.130.0030.00318.77
8.1.120.0000.00717.37
8.1.110.0080.00017.42
8.1.100.0030.00617.35
8.1.90.0000.00717.35
8.1.80.0030.00317.38
8.1.70.0070.00017.39
8.1.60.0040.00417.54
8.1.50.0040.00417.41
8.1.40.0050.00317.43
8.1.30.0080.00017.60
8.1.20.0040.00417.72
8.1.10.0000.00817.46
8.1.00.0030.00617.59
8.0.300.0070.00020.16
8.0.290.0050.00216.75
8.0.280.0070.00018.32
8.0.270.0030.00317.32
8.0.260.0030.00319.02
8.0.250.0000.00717.00
8.0.240.0030.00617.03
8.0.230.0040.00416.98
8.0.220.0000.00716.80
8.0.210.0080.00016.93
8.0.200.0030.00616.87
8.0.190.0000.00716.97
8.0.180.0050.00316.95
8.0.170.0040.00416.86
8.0.160.0030.00316.86
8.0.150.0030.00616.88
8.0.140.0000.00716.75
8.0.130.0030.00313.41
8.0.120.0020.00516.86
8.0.110.0000.00716.94
8.0.100.0080.00016.84
8.0.90.0040.00416.69
8.0.80.0070.00716.85
8.0.70.0050.00316.96
8.0.60.0070.00016.93
8.0.50.0000.00817.01
8.0.30.0080.00717.26
8.0.20.0090.01117.40
8.0.10.0070.00016.91
8.0.00.0120.00816.68
7.4.330.0000.00615.55
7.4.320.0000.00716.62
7.4.300.0070.00016.43
7.4.290.0000.00716.49
7.4.280.0000.00816.61
7.4.270.0040.00416.54
7.4.260.0070.00016.58
7.4.250.0030.00316.57
7.4.240.0040.00416.53
7.4.230.0030.00516.63
7.4.220.0130.00316.68
7.4.210.0100.00316.48
7.4.200.0050.00216.59
7.4.160.0090.00716.52
7.4.150.0100.00717.40
7.4.140.0070.01217.86
7.4.130.0040.01316.49
7.4.120.0100.01116.61
7.4.110.0120.00616.51
7.4.100.0070.01716.54
7.4.90.0060.01216.50
7.4.80.0150.00319.39
7.4.70.0140.00416.54
7.4.60.0250.02116.53
7.4.50.0090.00316.18
7.4.40.0100.00616.63
7.4.30.0070.01016.54
7.4.00.0000.01614.85
7.3.330.0030.00313.37
7.3.320.0000.00513.21
7.3.310.0050.00216.32
7.3.300.0030.00316.23
7.3.290.0110.00716.36
7.3.280.0090.01016.36
7.3.270.0130.00317.40
7.3.260.0140.00616.50
7.3.240.0110.00616.69
7.3.230.0080.00816.37
7.3.210.0060.00916.42
7.3.200.0100.01016.43
7.3.190.0110.01316.63
7.3.180.0110.01116.49
7.3.170.0080.00816.60
7.3.160.0000.01716.41
7.3.10.0140.00016.36
7.3.00.0000.01616.42
7.2.330.0060.01216.51
7.2.320.0070.01016.72
7.2.310.0160.00316.77
7.2.300.0090.01516.69
7.2.290.0070.01016.57
7.2.130.0030.01216.97
7.2.120.0030.01016.89
7.2.110.0090.00617.01
7.2.100.0000.01216.95
7.2.90.0070.00717.01
7.2.80.0070.00716.63
7.2.70.0100.00717.02
7.2.60.0170.00516.98
7.2.50.0030.01216.82
7.2.40.0070.00417.03
7.2.30.0100.00316.89
7.2.20.0090.00617.02
7.2.10.0030.00916.88
7.2.00.0040.00918.11
7.1.250.0030.01015.61
7.1.200.0060.00915.63
7.1.70.0030.00617.02
7.1.60.0030.00717.25
7.1.50.0130.06040.86
7.1.40.0170.01034.25
7.1.30.0130.01034.42
7.1.20.0100.01334.39
7.1.10.0030.01016.41
7.1.00.0000.01316.63
7.0.200.0070.00716.81
7.0.190.0030.05722.30
7.0.180.0030.01016.19
7.0.170.0100.00316.30
7.0.160.0030.01016.14
7.0.150.0070.00316.21
7.0.140.0000.01316.09
7.0.130.0000.01316.42
7.0.120.0030.01016.64
7.0.110.0070.00716.23
7.0.100.0100.00316.43
7.0.90.0030.00716.20
7.0.80.0030.00716.23
7.0.70.0070.00316.14
7.0.60.0030.00716.21
7.0.50.0070.00716.20
7.0.40.0100.00016.35
7.0.30.0000.01016.36
7.0.20.0000.01016.13
7.0.10.0030.00716.11
7.0.00.0000.01016.29

preferences:
65.16 ms | 401 KiB | 5 Q