Iterate over each element in an array with foreach for easy access to both keys and values.
Source Code
$fruits = ['apple' => 'red', 'banana' => 'yellow', 'grape' => 'purple'];
foreach ($fruits as $fruit => $color) {
echo "$fruit is $colorn";
}