Php 如何在循环中重复内部数组?

Php 如何在循环中重复内部数组?,php,arrays,Php,Arrays,我可以在循环中重复内部数组,因为我需要它从数据库中重复。 谢谢 嵌套的for循环就是答案: $locations = array( array('Eifel Tower', 48.858278, 2.294254, '#FF7B6F', 'eifel-tower.jpg', 120, 160), array('The Louvre', 48.8640411, 2.3360444, '#6BE337', 'the-louvre.jpg', 160, 111), array

我可以在循环中重复内部数组,因为我需要它从数据库中重复。
谢谢

嵌套的
for
循环就是答案:

$locations = array(
    array('Eifel Tower', 48.858278, 2.294254, '#FF7B6F', 'eifel-tower.jpg', 120, 160),
    array('The Louvre', 48.8640411, 2.3360444, '#6BE337', 'the-louvre.jpg', 160, 111), 
    array('Musee d\'Orsay', 48.860181, 2.3249648, '#E6E325', 'musee-dorsay.jpg', 160, 120), 
    array('Jardin du Luxembourg', 48.8469529, 2.337285, '#61A1FF', 'jardin-du-luxembourg.jpg', 160, 106), 
    array('Promenade Plantee', 48.856614, 2.3522219, '#FF61E3', 'promenade-plantee.jpg', 160, 120)
);
for($i=0;$i
正如Houssni所发布的,但您也可以这样做:

for ($i = 0; $i < count($locations); $i++)
{
    for ($j = 0; $j < count($locations[$i]); $j++)
    {
        echo $locations[$i][$j];
    }
}

这就是——展示你的方法,解释什么不起作用,提供有效的代码和预期的结果。因为这是你的第一篇帖子,所以你看到了这个澄清——但在未来,这可能会成为你被否决的问题。你的问题并不清楚。请你换个说法好吗?我得重复一遍。这一个“阵列('Eifel Tower',48.858278,2.294254',#FF7B6F','Eifel Tower.jpg',120160)”
foreach ($location as $location_array)
{
    foreach ($location_array as $location_detail)
    {
        var_dump($location_detail);
    }
}