2

我有一个 3d 数组,需要用它做点什么,能够使用简单的 for each 来解决问题,如下所示:

for($n=0;$n<count($d["T"]);$n++)
{
 $d["T"][$n]["Pay"]=number_format($d["T"][$n]["Pay"], 2, '.', '');
}
4

2 回答 2

4

最简单的技术是嵌套 Foreach 外观 ... 喜欢

foreach($arrD as $key => $arrInternal){

    foreach($arrInternal as $keyIn => $Data){

          //Perform your operation here
    }

}
于 2012-07-09T08:12:14.340 回答
3
foreach ($d["T"] as &$var) {
  $var['Pay'] = number_format($var['Pay'], 2, '.', '');
}
于 2012-07-09T08:11:16.150 回答