PHP Build a Basic PHP Website (2018) Listing and Sorting Inventory Items Introducing Arrays

foreach loop

Trying to get the foreach loop for this task.

index.php
<?php
echo $letters = ['A', 'C', 'M', 'E'];



echo "Today's challenge is brought to you by the ";
echo count($letters);
echo $letters;
foreach ($letters as $value) {
    echo "$value <br>";
}";


?>

1 Answer

Remove that double quotation mark next to the for-loop's closing curly brace.

<?php
echo $letters = ['A', 'C', 'M', 'E'];



echo "Today's challenge is brought to you by the ";
echo count($letters);
echo $letters;
foreach ($letters as $value) {
    echo $value;
};