<?php
$products = array(
array("name"=>"apple", "count"=>1),
array("name"=>"google", "count"=>2),
array("name"=>"ms", "count"=>4)
);
echo "one:<br/>";
for ($i=0; $i < count($products); $i++) {
foreach ($products[$i] as $key => $value) {
echo $key."-".$value.",";
}
echo "<br/>";
}
echo "<br/>two:<br/>";
for ($j=0; $j < count($products); $j++) {
while(list($k, $v) = each($products[$j])){
echo $k."|".$v.",";
}
echo "<br/>";
}
?>
这段代码只是输出:
one:
name-apple,count-1,
name-google,count-2,
name-ms,count-4,
two:
我想知道为什么这两部分不输出?