Use foreach, while and list to loop through associate array
<?php
$characters = array(
array(
"name" => "A",
"occupation" => "A1",
"age" => 30,
"special power" => "A3"
),
array(
"name" => "B",
"occupation" => "B1",
"age" => 24,
"special power" => "B2"
),
array(
"name" => "C",
"occupation" => "C1",
"age" => 45,
"special power" => "C2"
)
);
foreach ($characters as $c) {
while (list($k, $v) = each ($c)) {
echo "$k ... $v <br/>";
}
}
?>
Related examples in the same category