これはちょっとびっくり
<?php
$array1=array( "果物"=>array("りんご","みかん","すいか","メロン"),
"お菓子"=>array("ポテチ","どら焼き","キャラメルコーン","羊羹"),
"ご飯"=>array("麦飯","白米","オートミール","ラーメン"),
"野菜"=>array("キャベツ","ピーマン","じゃがいも","白菜"),
"さかな"=>array("鯖","マグロ","イカ","鮭")
);
$array2=array( "おかず"=>array("鯖缶","ツナ缶","野菜炒め","焼き魚"),
"サプリメント"=>array("ウィダー","プロティン","スポーツ羊羹") );
$array3=array( "豚肉"=>array("ブタコマ","タン","バラ","豚足"),
"鶏肉"=>array("胸肉","チキンカツ","手羽先","ナンコツ") );
$i=0;
foreach($array1 as $key =>$value){
$i++;
if( $key=="お菓子" ){
array_splice($array1,$i,0,$array2);
}
if( $key=="ご飯" ){
array_splice($array1,$i,0,$array3);
}
print $key."\n";
var_dump($value);
}
print_r($array1);
?>