I have a problem with converting string to float.
print gettype($value[$id]); //returns string
var_dump($value[$id]);//returns string '34,7140' (length=7)
$float = floatval($value[$id]);
print gettype($float);//returns double
var_dump($float);//returns float 34
echo $float;//returns 34
I don’t understand why “34” ? Why $float is not ‘34,7140’?
How can I get $float = 34,7140 ?
The problem is that floats are expected to be in the English format with a
.separating the decimal part, not a comma. If the format is always the same with a single comma, use this: