Reputation: 323
I need to output a $result
to two places I have tried
echo "<td>" .number_format($result,2). "</td>\n";
which results in a long string of decimals. And I have also tried "%u.1" which simply prints a ".1" literally after every number.
How do I simply output a numeric result to 1 decimal place?
Upvotes: 0
Views: 3618
Reputation: 2365
You may try as :
echo "<td>" .number_format((float)$result, 1). "</td>\n";
Upvotes: 2