3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $parts = [150, 270, 360]; $output = []; foreach ($parts as $a) { $output[] = [$a]; } foreach ($parts as $a) { foreach ($parts as $b) { $output[] = [$a, $b]; } } foreach ($parts as $a) { foreach ($parts as $b) { foreach ($parts as $c) { $output[] = [$a, $b, $c]; } } } var_dump($output);
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.3.0rc3
array(39) { [0]=> array(1) { [0]=> int(150) } [1]=> array(1) { [0]=> int(270) } [2]=> array(1) { [0]=> int(360) } [3]=> array(2) { [0]=> int(150) [1]=> int(150) } [4]=> array(2) { [0]=> int(150) [1]=> int(270) } [5]=> array(2) { [0]=> int(150) [1]=> int(360) } [6]=> array(2) { [0]=> int(270) [1]=> int(150) } [7]=> array(2) { [0]=> int(270) [1]=> int(270) } [8]=> array(2) { [0]=> int(270) [1]=> int(360) } [9]=> array(2) { [0]=> int(360) [1]=> int(150) } [10]=> array(2) { [0]=> int(360) [1]=> int(270) } [11]=> array(2) { [0]=> int(360) [1]=> int(360) } [12]=> array(3) { [0]=> int(150) [1]=> int(150) [2]=> int(150) } [13]=> array(3) { [0]=> int(150) [1]=> int(150) [2]=> int(270) } [14]=> array(3) { [0]=> int(150) [1]=> int(150) [2]=> int(360) } [15]=> array(3) { [0]=> int(150) [1]=> int(270) [2]=> int(150) } [16]=> array(3) { [0]=> int(150) [1]=> int(270) [2]=> int(270) } [17]=> array(3) { [0]=> int(150) [1]=> int(270) [2]=> int(360) } [18]=> array(3) { [0]=> int(150) [1]=> int(360) [2]=> int(150) } [19]=> array(3) { [0]=> int(150) [1]=> int(360) [2]=> int(270) } [20]=> array(3) { [0]=> int(150) [1]=> int(360) [2]=> int(360) } [21]=> array(3) { [0]=> int(270) [1]=> int(150) [2]=> int(150) } [22]=> array(3) { [0]=> int(270) [1]=> int(150) [2]=> int(270) } [23]=> array(3) { [0]=> int(270) [1]=> int(150) [2]=> int(360) } [24]=> array(3) { [0]=> int(270) [1]=> int(270) [2]=> int(150) } [25]=> array(3) { [0]=> int(270) [1]=> int(270) [2]=> int(270) } [26]=> array(3) { [0]=> int(270) [1]=> int(270) [2]=> int(360) } [27]=> array(3) { [0]=> int(270) [1]=> int(360) [2]=> int(150) } [28]=> array(3) { [0]=> int(270) [1]=> int(360) [2]=> int(270) } [29]=> array(3) { [0]=> int(270) [1]=> int(360) [2]=> int(360) } [30]=> array(3) { [0]=> int(360) [1]=> int(150) [2]=> int(150) } [31]=> array(3) { [0]=> int(360) [1]=> int(150) [2]=> int(270) } [32]=> array(3) { [0]=> int(360) [1]=> int(150) [2]=> int(360) } [33]=> array(3) { [0]=> int(360) [1]=> int(270) [2]=> int(150) } [34]=> array(3) { [0]=> int(360) [1]=> int(270) [2]=> int(270) } [35]=> array(3) { [0]=> int(360) [1]=> int(270) [2]=> int(360) } [36]=> array(3) { [0]=> int(360) [1]=> int(360) [2]=> int(150) } [37]=> array(3) { [0]=> int(360) [1]=> int(360) [2]=> int(270) } [38]=> array(3) { [0]=> int(360) [1]=> int(360) [2]=> int(360) } }