是否可以使用此数组
array (
[0] => array (
[0] => 'Size',
[variation_id] => array (
[0] => 'S',
[1] => 'M',
[2] => 'L',
[3] => 'XL'
)
),
[1] => array (
[0] => 'Length',
[variation_id] => array (
[0] => '14 Inches',
[1] => '18 Inches'8
)
)
)
获得这样的结果
变体名称
如果没有,请给我一些建议.. 感谢
答案 0 :(得分:0)
只需使用两个foreach
$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);