[PHP] Var_dumpを使用せずにネストされた配列をechoする方法
Var_dumpを使用せずにネストされた配列をechoする方法はこちら
<?php
$array = [
'person1' => [
'name' => 'John',
'age' => 25,
'email' => 'john@example.com'
],
'person2' => [
'name' => 'Jane',
'age' => 28,
'email' => 'jane@example.com'
]
];
foreach ($array as $personKey => $personData) {
echo $personKey . ':<br>';
foreach ($personData as $key => $value) {
echo ' ' . $key . ': ' . $value . '<br>';
}
}
?>