我想将多维数组分解为更多单个数组。 这是我的阵列显示..
Array
(
[family] => opensans
[variants] => Array
(
[0] => 300
[1] => 300italic
[2] => regular
[3] => italic
[4] => 600
[5] => 600italic
)
[subsets] => Array
(
[0] => cyrillic-ext
[1] => vietnamese
[2] => greek-ext
[3] => greek
[4] => cyrillic
[5] => latin-ext
[6] => latin
)
)
我想要不同阵列中的族/变体/子集,所以请帮助我。 提前谢谢。
答案 0 :(得分:0)
说出你的数组
Array
(
[family] => opensans
[variants] => Array
(
[0] => 300
[1] => 300italic
[2] => regular
[3] => italic
[4] => 600
[5] => 600italic
)
[subsets] => Array
(
[0] => cyrillic-ext
[1] => vietnamese
[2] => greek-ext
[3] => greek
[4] => cyrillic
[5] => latin-ext
[6] => latin
)
)
存储在变量$myArr
然后你需要这样做。
foreach($myArr as $key => $value):
${key} = $value;
endforeach;
应该为您提供3个数组,存储为$family
,variants
& subsets
。不确定家庭,是一个字符串?在这种情况下,除非你强制它作为一个数组,否则它将再次成为字符串。