I've a JSON (i.e. a javascript object).
I have a page that get the content of the JSON (i.e. a set of fields,array and objects).
Some of these fields are float values. The number of DECIMAL DIGITS depends on the specific field.
My question is: how do I print the WHOLE number as it was a STRING"?
Example:
12.35 --> print: 12.35 (but this is ok,a floatval() works!)
12.0 --> print: 12.0 (this is NOT ok,because floatval() prints just "12")
12.00 --> print: 12.00 (this is NOT ok,because floatval() prints just "12")
Of course I tried to print the value without casting(i.e. without using floatval() ). But is seems that the cast is done "implicity" by PHP.
And of course if there are not 0 (e.g. "12") no 0s should be printed
Thank you in advance for any tip.