How to remove decimals in PHP?
How to remove decimals in PHP?
1 Answer
to remove decimals in PHP can be easily done through
casting to integer
Example
<?php
$number = 199.66;
$number = (int)$number;//convert to int
echo $number;
?>
Output
199
intval() function
this function will return the integer value of the variable
Example
<?php
$number = 199.66;
$number = intval($number);//convert to int
echo $number;
?>
Output
199
answer Link