3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data = array ( array ( 'Size', 'variation_id' => array ( 'S', 'M', 'L', 'XL' ) ), array ( 'Length', 'variation_id' => array ( '14 Inches', '18 Inches', ) ) ); $sizes = $data[0]['variation_id']; $lengths = $data[1]['variation_id']; $result = array(); foreach($sizes as $size) foreach($lengths as $length) $result[] = "variation ($size, $length)"; var_dump($result);
Output for 4.3.0 - 7.1.0
array(8) { [0]=> string(24) "variation (S, 14 Inches)" [1]=> string(24) "variation (S, 18 Inches)" [2]=> string(24) "variation (M, 14 Inches)" [3]=> string(24) "variation (M, 18 Inches)" [4]=> string(24) "variation (L, 14 Inches)" [5]=> string(24) "variation (L, 18 Inches)" [6]=> string(25) "variation (XL, 14 Inches)" [7]=> string(25) "variation (XL, 18 Inches)" }