May I ask which one is more efficient?
吴小辰阿
吴小辰阿 2019-05-13 16:30:05
0
1
1145

请问以下两种写法 哪种执行效率高呢?

-------------------------------

foreach ($arr as $k => $i){
list($value) = each($arr);
echo '

'.$value.'

';
echo'';
foreach ($i as $item => $kitem) {
echo '';
while(list($key,$value) = each($kitem)){
echo '' ;
}
echo '';
}
echo '
'.$value.'
';
};

-----------------------------------------------------------


while(list($key,$value)=each($arr)){

echo "

" . $key . "

";

echo "";

while(list($k,$v)=each($value)){

echo '';

while(list($kk,$vv)=each($v)){

echo '';

}

echo '';

}

echo '
' . $vv . '
';

}

吴小辰阿
吴小辰阿

reply all (1)
V

foreach() is specially prepared for arrays


    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!