Loop type

WBOY
Release: 2016-07-25 09:09:30
Original
1091 people have browsed it

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 < count($files); $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. ?>
复制代码



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
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!