Preview:
// to loop in an associative array to get the keys and values using for each

<?php 

$assArray = [
        "Subject" => "Mathematics", "Weeks" => 10, "Difficulty" => 8
];

foreach ($assArray as $key => $value) {
    echo "The $key is $value <br />";
}
?>
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter