In the most simplest code this could be shown as the following.
All the
sprintf function is doing is taking your integer (14) and diving by 10 to give you a float (1.4). The rounding of the numbers, as seen in the
sprintf, is necessary merely to limit the number of digits that are displayed subsequent to the decimal point. In the
sprintf's example, we are limited to a mere one digit after the decimal point. In my example I don't use any rounding, although if need be we could use
round. I have left this out though to keep the example simple.
Although, I do suggest using the
sprintf method because it looks better and also you have more control in fewer lines, I hope the code below helps you understand the functionality behind Salathe's solution.
php Code:
$iNumber =
14;
$iTotal =
14 /
10;
echo $iTotal;