PHP Loops

Loops are used to execute a code till a specific condition/counter.

PHP Supports four type of Loops

  • For Loop
  • While Loop
  • Do…While Loop
  • Foreach Loop

For Loop

For Loop executes a code till the specified number.

		echo $a."<br>";

Foreach Loop

Foreach loop only works on arrays. and is used to loop through each key/value in an array

	foreach($color as $value){
		echo $value."<br>";