I'm learning array and loop in php. But can't print the array with keys & values. How can I do this?
<?php
$marks = array (
"Alice" => array (
"physics" => "60",
"math" => "65"
),
"Bob" => array (
"physics" => "40",
"math" => "45"
)
);
foreach ( $marks as $key => $value) {
foreach ( $key as $key2 => $value2 ) {
echo $key . " : " . $key2 . " - " . $value2 . "<br>";
};
};
?>
foreach ( $value as $key2 => $value2 ) {