如何防止 $key 在第一个循环中的值,但我需要在第二个循环中调用 $key?第一个循环中 $key 的值与第二个循环不同
<?php
$variables = array('ABC' => array('A', 'B', 'C'), 'DEF' => array('D', 'E'));
foreach ($variables as $key => $values){
echo $key; //the value of $key in first loop is different to the second loop
foreach($values as $value){
echo $key; //I want the value of $key is still the value in first loop
}
}
?>