本文介绍了哪个循环更快,同时还是为了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!



while:

  


You can get the same output with for and while loops:

While:

$i = 0;
while ($i <= 10){
  print $i."\n";
  $i++;
};

For:

for ($i = 0; $i <= 10; $i++){
  print $i."\n";
}

But which one is faster?

解决方案

That clearly depends on the particular implementation of the interpreter/compiler of the specific language.

That said, theoretically, any sane implementation is likely to be able to implement one in terms of the other if it was faster so the difference should be negligible at most.

这篇关于哪个循环更快,同时还是为了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 14:12