製品の価格を表示しようとしていますが、価格が整数値の場合は小数点以下「.00」を表示しません。しかし、現在の結果は常に 10 進数の値を示しています。現在のロジックを以下に示します。
$price_value = "20.00"; //coming from DB as string
if (is_int($price_value)) {
//Display whole number without decimal
$to_print = number_format($price_value,0);
else {
//Show the decimal value
$to_print = number_format($price_value,2);
}
//When I print this value I always get "`20.00`" not "`20`"