我試圖通過foreach將值添加到數組,但它只返回單詞「數組」而不是實際的字符串。通過foreach向數組添加值
$msg = array();
foreach ($results as $result) {
$inventory = $result->qoh;
$inventoryOrder = $result->qo;
$product = $result->item;
$totalinv = $inventory+$inventoryOrder;
if ($inventory <= $threshold) {
$message = "Inventory for $product has fallen beneath threshold. $inventory remaining.\n";
$msg[] = array($message);
}
}
print (array_values($msg));
我已經嘗試了幾種不同的方式,每次它返回
使用的print_r打印陣列...打印將永遠只能打印「數組」 – hackartist 2012-03-21 18:48:55