PHP format a number to have no decimal places?

number-formatting, php

Solution

Use `number_format()`

echo number_format('1.000000'); // prints 1

Or use `intval()`

echo intval('1.000000'); // prints 1

Or cast it as an integer

echo (int) '1.000000'; // prints 1

Problem

I have a number (as string) like this: 1.00000 How can I reformat such numbers to only look like 1? Thanks

Original source