How do I remove decimals in PHP?

Say that I have a variable that outputs a number such as:
17.672

I would prefer the number to display as “17”

Rather than rounding, how would I remove the decimal notation from this number?

floor(17.672);

floor() makes it stay as a float, so mark’s solution below (same as intval(17.672) ) might be better.

echo (int)17.672;

echo round(10.5); // Round the number, this example would echo 11.
echo '<br />';
echo floor(10.5); // Round down, this would echo 10.
echo '<br />';
echo ceil(10.3); // Round up, this would be 11.

Thanks guys :slight_smile: