In PHP (using built-in functions) I\'d like to convert/format a number with decimal, so that only the non-zero decimals show. However, another requirement of mine is that if
%s\n", $number, (float) $number == (int) $number ? number_format($number, 1) : (float) $number ); } ?>
Output:
9.000 -> 9.0 9.100 -> 9.1 9.120 -> 9.12 9.123 -> 9.123