我试图通过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