PHP Loops (For, While and Do-While, break, continue)

Back To PHP Index


1. php program to demonstrate for statement to display numbers from 0 to 9 - Code
2. php program to demonstrate for statement to display numbers from 0 to 10 - Code
3. php program to display numbers from 9 to 0 (in reverse order) using for statement - Code
4. php program to display numbers from 10 to 0 (in reverse order) using for statement - Code
5. php program to display numbers 0 to 10 with a gap of 2 between the numbers using for statement - Code
6. php program to display numbers 0 to 50 with a gap of 5 between the numbers using for statement - Code
7. php program to display numbers 50 to 1 (in reverse order) with a gap of 5 between the numbers using for statement - Code
8. php program to find sum of numbers from 1 to 10 using for statement - Code
9. php program to find sum of even numbers from 1 to 10 using for statement - Code
10. php program to find sum of odd numbers from 1 to 10 using for statement - Code
11. php program to find sum of even and odd numbers from 1 to 10 using for statement - Code
12. php program to input two numbers a and b and display numbers between them using for loop - Code
13. php program to input two numbers a and b and find sum of numbers between them using for statement - Code
14. php program to find factorial of a number using for statement - Code
15. php program to find whether number entered is prime or not using for statement - Code
16. php program to print first 1 to 10 terms of fibonicci series using for statement - Code
17. php program to print pattern of stars using for statement (example of nested for loop) - Code
18. php program to print table of a number entered by the user using for statement - Code
19. php program to print numbers from 0 to 9 using while statement - Code
20. php program to print numbers from 1 to 10 using while statement - Code
21. php program to print numbers from 1 to 10 with a gap of 2 numbers using while statement - Code
22. php program to find factorial of a number using while statement - Code
23. php program to print table of a number entered by user using while statement - Code
24. php program to find sum of numbers from 1 to 10 using while statement - Code
25. php program to input two numbers and find sum of numbers between them using while statement - Code
26. php program to find sum of even and odd numbers between a and b using while statement - Code
27. php program to check whether a number is prime or not using while statement - Code
28. php program to print first 1 to 10 terms of fibonicci series using while statement - Code
29. php program to find lcm and hcf of 2 numbers using while loop - Code
30. php program to demonstrate do while statement example to print numbers 1 to 10 - Code
31. php program to demonstrate do while example 2, prints 11 on the output screen - Code
32. php program to demonstrate break statement in for loop - Code
33. php program to demonstrate break statement in while loop - Code
34. php program to demonstrate continue statement - Code