Loops

PHP provides an easy way to use every element of an array with the For each statement. For each executes the code at each item in the specified array. While a For Loop and While Loop will continue until some condition fails, the For Each loop will continue until it has gone through every item […]

{ 0 comments }

A “do while” loop is a slightly modified version of the while loop. A do-while loop first do’s and secondly checks the while condition! PHP Do While Loop Structure – Define – Do – Print – Increment or decrement – Condition

{ 0 comments }

PHP While Loop

by Hiroshi on June 21, 2008

in Loops, PHP Basics, While Loop

The while keyword takes a condition in parentheses, and the code block that follows is repeated while that condition is true. If the condition is false initially, the code block will not be repeated at all. The repeating code must perform some action that affects the condition in such a way that the loop condition […]

{ 1 comment }

PHP For Loop

by Hiroshi on June 21, 2008

in For Loop, Loops, PHP Basics

For loop consists of three phases. i.e. Define Condition Increment or decrement First we define something. Then we apply a condition and then under that condition we increment or decrement that defined thing. In complex way; – The first part is an expression that is evaluated once when the loop begins. – The second part […]

{ 1 comment }

For Loop in PHP

by Hiroshi on June 19, 2008

in Loops, Randomizing, Scripts

I am describing for loop with an example that include randomizing number display using images from a directory. Use following script and create a folder nb and put images 0.gif, 1.gif, … , 9.gif containing same digit over each and see.

{ 0 comments }