How to use for each loop in php

PHP

For each loop is the smarter loop to use. It can be played with the keys and index values .

Mainly people use for loop more but some critical situation are faced where we are forced to use the for each loop.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FOR EACH LOOP Examples in PHP</title>
</head>
<body>
<?php
//Lets take one simple example of array to print values with the for loop
$array = array('A','B','C','D');


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


?>
</body>
</html>
-->