lIP TT lIP TT - 8 months ago 52
PHP Question

PHP return 1 number after dot in float

I have got this php code

echo $Likes."k";

This code returns me 1.112k,but my goal is to get 1.1k


Use the number_format function:

echo number_format($Likes,1)."k";

And a coding style advice: don't start your variables with an upper case letter!