次のような多次元配列があります。
Array
(
[Category1] => Array
(
[1] => Array
(
[0] => Img 1
[1] => Title 1
[2] => Text 1
)
[5] => Array
(
[0] => Img 17
[1] => Title 17
[2] => Text 5
)
[10] => Array
(
[0] => Img 1
[1] => Title 6
[2] => Text 10
)
[16] => Array
(
[0] => Img 16
[1] => Title 12
[2] => Text 16
)
)
[Category2] => Array
(
[2] => Array
(
[0] => Img 2
[1] => Title 2
[2] => Text 2
)
[6] => Array
(
[0] => Img 18
[1] => Title 18
[2] => Text 6
)
[13] => Array
(
[0] => Img 13
[1] => Title 9
[2] => Text 13
)
)
[Category3] => Array
(
[3] => Array
(
[0] => Img 3
[1] => Title 3
[2] => Text 3
)
[7] => Array
(
[0] => Img 19
[1] => Title 19
[2] => Text 7
)
[11] => Array
(
[0] => Img 11
[1] => Title 7
[2] => Text 11
)
[14] => Array
(
[0] => Img 14
[1] => Title 10
[2] => Text 14
)
)
[Category4] => Array
(
[4] => Array
(
[0] => Img 4
[1] => Title 4
[2] => Text 4
)
[8] => Array
(
[0] => Img 20
[1] => Title 20
[2] => Text 8
)
[15] => Array
(
[0] => Img 15
[1] => Title 11
[2] => Text 15
)
)
[Category5] => Array
(
[9] => Array
(
[0] => Img 9
[1] => Title 5
[2] => Text 9
)
)
[Category6] => Array
(
[12] => Array
(
[0] => Img 12
[1] => Title 8
[2] => Text 12
)
)
)
このように表示するにはヘルプが必要です。$myarray は上の例のとおりです。最初のforeachではすべて問題ありませんが、1つのカテゴリに複数の配列がある場合、2番目と3番目のforeachでは複製され、正しく表示されません。
<div id="tab-container">
<ul>
<?php foreach ($myarray as $category => $detail) { ?>
<li><a href="#tab-<?=$category?>"><?=$category?></a></li>
<?php }; ?>
</ul>
<div>
<?php foreach (??? ??? ???) { ?>
<div id="tab-<?=$category?> for ex Category 1 contain Array (1, 5 10, 16)">
<div class="tab-content_left">
<div><img src="<?=base_url();?>img/$value[0] for ex Img 1" /></div>
<div>$value[1] for ex Title 1</div>
<div>$value[2] for ex Text 1</div>
</div>
<div class="tab-content_right">
<?php foreach (??? ??? ???) { ?>
<div><img src="<?=base_url();?>img/"$value[0] for ex Img 17 /></div>
<div>$value[1] for ex. Title 17</div>
<div>$value[2] for ex Text 5</div>
<?php }; ?>
</div>
</div>
<?php }; ?>
</div>
</div>
THX。どうすれば foreach cicles をどこに配置できますか?