我有这个数组。我想存档以下内容并显示每个包名称和截止日期
1.CLASSIC ASIA PLUS (2015-10-25)
2.NEW SMART (2017-10-18)
这是数组
Array
(
[0] => Array
(
[subid] => 618341
[currentpackage] => CLASSIC ASIA PLUS
[lastpackage] => CLASSIC ASIA PLUS
[duedate] => 2017-10-25
[dueamount] => 54499
[balance] => 443034
[subclient] => ZukuSatUg
)
[1] => Array
(
[subid] => 618341
[currentpackage] => NEW SMART
[lastpackage] => NEW SMART
[duedate] => 2017-10-18
[dueamount] => 399
[balance] => 1
[subclient] => ZukuSatKe
)
)
这是我到目前为止所尝试的
foreach ($package as $key => $val) {
return $package[$key]['currentpackage']." [". $package[$key]['duedate']."]";
}
结果是这个
CLASSIC ASIA PLUS [2017-10-25]
仅适用于第一个。
答案 0 :(得分:0)
我找到了解决方案
$list = null;
foreach ($package as $key => $val) {
$list.= $package[$key]['currentpackage']." [". $package[$key]['duedate']."] \n";
}
return $list;
out put是
CLASSIC ASIA PLUS [2017-10-25]
NEW SMART [2017-10-18]