我在foreach循環中使用多維數組,但我沒有得到正確的結果。PHP foreach多維數組問題
陣列
$mainarray = array(
array('field_name' => 'xx',
'email_label' => 'xxxx',
'validation_type' => 'xxxxx',
'validation_msg' => 'xxxxxx'),
array('field_name' => 'xx',
'email_label' => 'xxxx',
'validation_type' => 'xxxxx',
'validation_msg' => 'xxxxxx'),
// more ....
}
foreach循環
foreach($mainarray as $fieldarray){
foreach($fieldarray as $key => $value){
$body .= $value['email_label'].' - '. $value['field_name'];
}
}
我需要的關鍵稱爲EMAIL_LABEL和FIELD_NAME的價值的,但我不得到正確的結果返回
感謝您的幫助 – user759235