adplus-dvertising
frame-decoration

Question

What will be the output of the following PHP code ?
<?php
function colour()
{ 
    $colors = array("red", "green", "blue", "yellow"); 
    foreach ($colors as $value)
    {
        echo "$value <br>";
    }
}
colour();
?>

a.

red
green
blue
yellow

b.

green
blue
yellow
red

c.

red
blue
yellow
green

d.

red
green
yellow
blue

Posted under PHP

Answer: (a).red
green
blue
yellow

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the following PHP code ?

Similar Questions

Discover Related MCQs