3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cartesian($input) { $result = array(); while (list($key, $values) = each($input)) { if (empty($values)) { continue; } if (empty($result)) { foreach($values as $value) { $result[] = array($key => $value); } } else { $append = array(); foreach($result as &$product) { $product[$key] = array_shift($values); $copy = $product; foreach($values as $item) { $copy[$key] = $item; $append[] = $copy; } array_unshift($values, $product[$key]); } $result = array_merge($result, $append); } } return $result; } $data = array ( 'machineAttribute' => array ( 'TTT 1000 S', 'TTT 1100 S' ), 'technicalAttribute' => array ( 'Certificate', 'Software' ), 'languageAttribute' => array ( 'English', 'Spanish', ) ); $combos = cartesian($data); $final_result = []; foreach($combos as $combo){ $final_result[] = implode('/',$combo); } print_r($final_result);

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.0060.01323.96
8.4.110.0120.00818.54
8.4.100.0090.01017.85
8.4.90.0140.00718.02
8.4.80.0140.00617.84
8.4.70.0100.00719.07
8.4.60.0140.00619.00
8.4.50.0060.00223.95
8.4.40.0030.01317.88
8.4.30.0160.00317.51
8.4.20.0070.01420.16
8.4.10.0120.00819.51
8.3.250.0120.00518.67
8.3.240.0040.00417.02
8.3.230.0090.00116.66
8.3.220.0150.00417.26
8.3.210.0090.01016.84
8.3.200.0140.00916.51
8.3.190.0080.00518.63
8.3.180.0100.00916.75
8.3.170.0110.00718.76
8.3.160.0180.00016.56
8.3.150.0050.00320.83
8.3.140.0000.00816.98
8.3.130.0070.01018.65
8.3.120.0000.00920.63
8.3.110.0110.00716.69
8.3.100.0030.00724.06
8.3.90.0040.00426.77
8.3.80.0060.00317.97
8.3.70.0140.00018.06
8.3.60.0110.00418.55
8.3.50.0090.00518.23
8.3.40.0090.00618.84
8.3.30.0120.00318.80
8.3.20.0080.00021.90
8.3.10.0060.00618.85
8.3.00.0050.00317.50
8.2.290.0090.01020.73
8.2.280.0080.00620.27
8.2.270.0070.01117.27
8.2.260.0110.00718.77
8.2.250.0000.00818.83
8.2.240.0030.00617.08
8.2.230.0040.00420.94
8.2.220.0090.00037.54
8.2.210.0100.01026.77
8.2.200.0060.00318.66
8.2.190.0070.00718.51
8.2.180.0120.00618.41
8.2.170.0000.01418.98
8.2.160.0060.00922.26
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0040.00417.97
8.2.120.0000.00826.35
8.2.110.0070.00320.95
8.2.100.0080.00317.91
8.2.90.0080.00018.16
8.2.80.0040.00417.97
8.2.70.0000.00817.91
8.2.60.0000.00717.91
8.2.50.0000.00918.10
8.2.40.0070.00019.08
8.2.30.0050.00219.18
8.2.20.0060.00317.91
8.2.10.0040.00419.32
8.2.00.0000.00717.98
8.1.330.0100.00616.59
8.1.320.0120.01116.15
8.1.310.0040.01116.89
8.1.300.0070.00018.44
8.1.290.0040.00430.84
8.1.280.0090.00625.92
8.1.270.0000.00720.32
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0000.01122.42
8.1.230.0070.00420.93
8.1.220.0040.00417.74
8.1.210.0030.00518.89
8.1.200.0030.00617.35
8.1.190.0080.00317.22
8.1.180.0040.00418.10
8.1.170.0000.00818.57
8.1.160.0000.00718.80
8.1.150.0040.00418.83
8.1.140.0000.00718.89
8.1.130.0040.00421.87
8.1.120.0000.00717.46
8.1.110.0040.00417.39
8.1.100.0020.00517.40
8.1.90.0040.00417.31
8.1.80.0050.00217.41
8.1.70.0070.00017.39
8.1.60.0070.00417.58
8.1.50.0080.00017.55
8.1.40.0000.01117.51
8.1.30.0040.00417.55
8.1.20.0030.00917.71
8.1.10.0000.00717.48
8.1.00.0000.00817.51
8.0.300.0000.00819.93
8.0.290.0090.00016.75
8.0.280.0000.00718.31
8.0.270.0040.00416.86
8.0.260.0000.00718.38
8.0.250.0030.00316.93
8.0.240.0030.00616.96
8.0.230.0000.00716.86
8.0.220.0000.00716.86
8.0.210.0000.00816.87
8.0.200.0030.00316.96
8.0.190.0070.00016.89
8.0.180.0030.00616.82
8.0.170.0080.00316.85
8.0.160.0040.00416.80
8.0.150.0040.00416.83
8.0.140.0070.00016.88
8.0.130.0030.00313.34
8.0.120.0000.00816.77
8.0.110.0080.00016.85
8.0.100.0050.00316.89
8.0.90.0070.00016.91
8.0.80.0060.01216.88
8.0.70.0050.00216.77
8.0.60.0040.00416.75
8.0.50.0040.00416.75
8.0.30.0120.00817.06
8.0.20.0070.01116.98
8.0.10.0040.00417.02
8.0.00.0110.01016.83
7.4.330.0000.00515.55
7.4.320.0000.00616.41
7.4.300.0000.00616.56
7.4.290.0030.00516.58
7.4.280.0000.00716.63
7.4.270.0000.00716.66
7.4.260.0060.00316.60
7.4.250.0050.00316.58
7.4.240.0040.00416.63
7.4.230.0000.00816.26
7.4.220.0000.00716.54
7.4.210.0040.01216.57
7.4.200.0080.00016.68
7.4.160.0080.00716.47
7.4.140.0120.00917.86
7.4.130.0090.00916.63
7.4.120.0090.00916.50
7.4.110.0060.01016.64
7.4.100.0120.00916.34
7.4.90.0150.00316.37
7.4.80.0090.01219.39
7.4.70.0090.00916.60
7.4.60.0120.00416.37
7.4.50.0030.01316.52
7.4.40.0130.00616.43
7.4.00.0070.00715.14
7.3.330.0050.00013.22
7.3.320.0030.00313.41
7.3.310.0030.00316.48
7.3.300.0030.00316.41
7.3.290.0030.00516.27
7.3.280.0080.01016.39
7.3.260.0100.00716.45
7.3.240.0110.00716.44
7.3.230.0110.00816.66
7.3.210.0100.00616.51
7.3.200.0080.00816.68
7.3.190.0060.01116.45
7.3.180.0080.00816.35
7.3.170.0060.01116.38
7.3.160.0110.01116.55
7.3.10.0540.00014.67
7.3.00.0710.00614.70
7.2.330.0100.00716.84
7.2.320.0100.01016.59
7.2.310.0000.01716.73
7.2.300.0120.00616.75
7.2.290.0100.00616.80
7.2.130.0540.00315.16
7.2.120.0470.00915.18
7.2.110.0420.00614.99
7.2.100.0520.00315.27
7.2.90.0470.00315.19
7.2.80.0500.01215.29
7.2.70.0490.01015.40
7.2.60.0560.00315.14
7.2.50.0490.00715.09
7.2.40.0630.00315.30
7.2.30.0630.00915.28
7.2.20.0450.00715.15
7.2.10.0470.00315.27
7.2.00.0420.00415.22
7.1.250.0470.00014.03

preferences:
29.77 ms | 403 KiB | 5 Q