これは私がこれまでに遭遇した最も奇妙な問題の1つであり、phpで合計しようとしている2つの数値がありますが、何らかの理由でphpでは正しい結果が得られません。
私はそれが私に与えるはず$itemPrice
のでを追加しようとしていますが、代わりに私は得ます。$shipPrice
3.50 + 2.80
6.30
5
使ってみましたfloatVal() function
が、違いはありません。何かアイデアはありますか?
以下はコードのサンプルです
phpコード
foreach($resp->ListOrderItemsResult->OrderItems->OrderItem as $order){
$itemPrice = $order->ItemPrice->Amount;
$shipPrice = $order->ShippingPrice->Amount;
$total = $itemPrice + $shipPrice;
$arr[] = array(
'sku' => $order->SellerSKU,
'isbn' => $order->ASIN,
'title' => $order->Title,
'item_price' => $itemPrice,
'ship_price' => $shipPrice,
'total' => $total,
'quantity_shipped' => $order->QuantityShipped,
);
}
出力
sku isbn title item_price ship_price total quantity_shipped
VM-F5TU-BN0K 1844831531 xxxxx 3.50 2.80 5 1