我需要以某种方式在一个foreach循环中获得两个数组(因为两个循环会弄乱它)。从我的数据库中选择两个数组。正如你在下面的var_dump中看到的,那么有相同的值,我不知道这是一个问题吗?
代码:
$getUserWorks = $work->getUserWorks($userInfo->id);
$getUserMachines = $work->getUserMachines($userInfo->id);
foreach(???){
?>
<tr>
<td>
<?php echo $array->orderid; ?>
</td>
<td>
<?php echo $array->work_hours; ?>
</td>
<td>
<?php
echo $array->machinename;
?>
</td>
<td>
<?php echo $array->machine_hours; ?>
</td>
<td>
</td>
</tr>
</tbody>
<?php } ?>
两个数组的Var_dump:
array (size=1)
0 =>
object(stdClass)[11]
public 'id' => string '2' (length=1)
public 'orderid' => string '4' (length=1)
public 'userid' => string '8' (length=1)
public 'work_hours' => string '4' (length=1)
public 'timestamp' => string '2015-06-28 12:48:34' (length=19)
array (size=1)
0 =>
object(stdClass)[7]
public 'id' => string '2' (length=1)
public 'orderid' => string '4' (length=1)
public 'userid' => string '8' (length=1)
public 'workid' => string '2' (length=1)
public 'machineid' => string '1' (length=1)
public 'machinename' => string 'test' (length=4)
public 'machine_hours' => string '4' (length=1)
public 'timestamp' => string '2015-06-28 12:48:34' (length=19)
答案 0 :(得分:2)
使用SPL&#39; MultipleIterator
$crypt = decryptAes($crypt, $gatewayOptions["encryptionPassword"]);