+ 1
Division in PHP
How can I get an integer as an answer from a division operation done in PHP? example: <?php $num1 = 8; $num2 = 6; echo $num1 / $num2; ?> Actual Output is 1.333 but I need 1 as the answer.
2 ответов
+ 18
echo intval($num1 / $num2);
+ 1
Thank you so much, Maz. This code can be used as well echo round($num1 / $num2);