Comparing PHP to ASP - Week 4 - Looping
2 Jun 2010 - tips-tutorials
Welcome to the fourth part of our 5 part tutorial where we will compare PHP with Classic ASP.
The objective of these tutorials is to show you how to do some basic programming in PHP and compare it to how you would do it in Classic ASP using VB Script.
This five part tutorial will be split into five sections:
Looping is an important part of any development language. For this tutorial we will look at some of the most common ones used as a developer.
For Loops in PHP
The 'For' loop is used when you know in advance how any items you want to loop through.
For Loops in Classic ASP
Both of these examples would output a sequence of numbers between 1 and 5.
For Each Loops in PHP
The 'For Each' loop is used to loop through an array.