douweilei2307 2010-05-24 06:03
浏览 36
已采纳

这两个foreach循环之间有什么区别?

I have seen in cakephp that foreach loop is used like this


foreach($tags as $tag) :
       \\code here
endforeach;

and I used to write this style of foreach


foreach($tags as $tag)
{
     //code here
}

what is the difference between these two foeach loops and which one is better and makes more sense to implement ?

Thanks

  • 写回答

6条回答 默认 最新

  • duandaodao6951 2010-05-24 06:09
    关注

    They are equivalent, but the second first is sometimes more readable when your PHP is embedded with HTML.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料