Comma is lost after propagation

user1876234

I have $number = '345,6'; and $time = '1'; After $sum = $number * $sum; the $sum becomes 345, instead of 345,6 Why is that and how to prevent losing comma and numbers ?

Tamás Zahola

First of all, don't store numbers as strings. Secondly, use a dot to separate the fractional part. Like this:

$number = 345.6;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related