我如何遍历此嵌套数组,而不会出现运行时间超过30秒的错误

时间:2018-06-30 23:37:03

标签: php arrays runtime-error

请问遍历嵌套数组的问题...

我有一个$ motherarr,里面有45个内容,每个内容($ childarr)是另一个数组,里面有不少于11个数组...对于$ childarr的每个项目,它也是9个项目的数组< / p>

遍历它们时,我遇到一种错误,指示运行时间已超过30秒...但是,如果我将$ motherarr的内容减少到10或更小,则可以正常工作...

请问如何在没有这些错误的情况下遍历该Arr ...这是我的代码

foreach($motherarr as $childarr => $value) {
//childarr is an array with not less than 11 arrays in each
if(is_array($childarr)) {
    foreach($childart as $key => $val) {
        //$key is an array with 9items in all
        foreach($key as $subkey => $subval){
            //get all the 9 items in $key 
        }
    }
}

}

0 个答案:

没有答案