I try to get the result
danny love to eat orange and banana and grapes
Is it possible to get it through the function foreach
my Sample Code
$var = array (" orange "," banana "," grapes ");
echo 'danny love to eat ';
//NOT THIS METHOD
// echo $var [0];
// echo ("and");
// echo $var [1];
// echo ("and");
// echo $var [2];
//Through this method
foreach ($var as $fruit) {
echo $fruit ;
echo ("and");
}
The result I get if i use foreach
danny love to eat orange and banana and grapes and
What's wrong ? :(