Is there any difference between floor()and intval()? Although both return the same results, are there any performance issues? Which of the two is faster? What proper php function will be used if I just want to return an integer value of only a decimal number?
The goal is to display 1999.99 through 1999, omitting the decimal value and returning only an integer.
$num = 1999.99;
$formattedNum = number_format($num)."<br>";
echo intval($num) . ' intval' . '<br />';
echo floor($num) . ' floor';
source
share