foreach($archive as $archrow){
echo $archrow->doc_name; //document name
echo $archrow->doc_status; //document status
}
foreach($arc as $arcrow){
echo $arcrow->fullname; //Author
}
foreach($pos as $posrow){
echo $posrow->position_name; //position
}
foreach($loc as $locrow){
echo $locrow->location; //Department
}
我想制作一张桌子并按类别安排它们:
________________________________________________________________________________
|文件名称|作者|职位|部门|文件状态|
| asdasd |约翰|经理|帐户| adsads |
答案 0 :(得分:4)
我想假设你想要同时从每个数组中提取一个元素
你可以尝试
$mi = new MultipleIterator(MIT_NEED_ANY|MIT_KEYS_NUMERIC);
$mi->attachIterator(new ArrayIterator($archive), 'achive');
$mi->attachIterator(new ArrayIterator($arc), 'arc');
$mi->attachIterator(new ArrayIterator($pos), 'pos');
$mi->attachIterator(new ArrayIterator($loc), 'loc');
echo "<pre>";
foreach ( $mi as $member ) {
echo $member['achive']->doc_name, "|", $member['achive']->doc_status, "|", $member['arc']->fullname, "|", $member['pos']->position_name, "|", $member['loc']->position_name ,PHP_EOL;
}
答案 1 :(得分:0)
如果要合并数组,可以使用array_merge
:http://www.php.net/manual/en/function.array-merge.php
但是你的例子不是数组...