使用foreach,list来遍历数组

<?php
$data = array('a' => 'data1', 'b' => 'data2', 'c' => 'data3');
while(list($subscript, $value) = each($data))
{
   echo "$subscript => $value :: ";
   echo "$subscript => $value <br>";
}

reset($data);
foreach($data as $subscript => $value)
{
   echo "$subscript => $value :: ";
   echo "$subscript => $value <br>";
}


?>

你可能感兴趣的:(c,list,each)