首页 >后端开发 >php教程 >循环类型

循环类型

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-07-25 09:09:301155浏览

Types of loops 循环类型。
  1. $files = array ('index.php', 'reports.php', 'welcome');
  2. echo "This is how foreach works
  3. ";
  4. foreach($files as $file){
  5. echo $file."
  6. ";
  7. };
  8. echo "
  9. ";
  10. echo "This is how for works
  11. ";
  12. for($index = 0; $index
  13. //echo "Index = ".$index."
  14. ";
  15. echo "File = ".$files[$index]."
  16. ";
  17. } Play Angry Birds
  18. echo "
  19. ";
  20. echo "This is how while works
  21. ";
  22. $index = 0;
  23. while($index
  24. //echo "Index = ".$index."
    ";
  25. echo "File = ".$files[$index]."
  26. ";
  27. $index++;
  28. }
  29. ?>
复制代码



声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn