在十進制數字中如何除去小數點後的多餘零以及如何避免舍入數字。 我曾嘗試下面的代碼如何在十進制值中插入逗號並刪除多餘的零
$example = "123456";
$exmaple2= "55.369";
$subtotal = number_format($example, 2, '.', ',');
$subtotal1 = number_format($exmaple2, 2, '.', ',');
echo $subtotal."<br/>";
echo $subtotal1;
得到輸出
123,456.00
55.37
預期輸出
123,456
55.369
正在打印的小計值123,其中,因爲我需要123,456其他明智的代碼是每個fect – atk
檢查我編輯的答案。 – shubham715
它是非常工作非常感謝你 – atk