PHP Arrays and Loops
foreach walks every item of an array.
Example
<?php
$tags = ["seo", "ai"];
foreach ($tags as $tag) {
echo $tag . "\n";
}
Your task
Loop over $colors and echo each colour followed by a new line.
PHP 8 Server-Side
foreach walks every item of an array.
<?php
$tags = ["seo", "ai"];
foreach ($tags as $tag) {
echo $tag . "\n";
}
Loop over $colors and echo each colour followed by a new line.
This lesson is checked against the lesson rules. Your code is never run on our servers.