创建无限循环的最佳方法是什么?
我一直在为此使用 while 循环,但最近与一位朋友争论哪种形式的迭代是在 PHP 中建立无限循环的最佳方法?
哪种迭代是无限循环的最佳类型?
I have been using a while loop for this but recently got into debate with a friend over what form of iteration is the best way to establish an infinite loop in PHP?
Which is the best type of iteration to infinitely loop?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因为,在这种情况下,条件评估将是最小的。
顺便说一句,你真的必须无限循环吗?你知道自己在做什么吗?我希望! :)
Because, in this case the condition evaluation will be minimal.
BTW, do you really have to loop infinitely? You know what you are doing right? I hope! :)
据我所知,这是个人喜好。我个人喜欢
while(1){}
,因为它比for(;;){}
更容易识别。As far as I know, it's personal preference. I personally like
while(1){}
, as it's easier for me to spot thanfor(;;){}
.