Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a PHP script to use a foreach loop to iterate over an array of colors and print each color.

Easy

Problem Statement

Create a PHP script to use a foreach loop to iterate over an array of colors and print each color.

Sample Input

An array of colors (e.g., ["Red", "Green", "Blue"]).

Sample Output

Red
Green
Blue

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
<?php // Write code to here ?>
Log in or sign up to run or submit your code.Log inSign up
Input
An array of colors (e.g., ["Red", "Green", "Blue"]).
Expected Output
Red
Green
Blue