Divide miles, speed time formatting

Hi, I am trying to display in minutes, instead of 0.2 hr etc
like the example below will do, now I know every .1 = 6 min
I am just stumped on how to get this to display 12 minutes.

PHP Code:
$sum = round(11 / 55,1);// example 11 miles
echo $sum;
I am trying to display things in minutes only when under 1 hour
Anyone know how to multiply just that number after the decimal by 6?


$hours = floor(round(11 / 55,1));
$minutes = (round(11 / 55,1) - $hours) * 6;

echo "$hours hours and $minutes minutes";

Something like that?

Another option is to use modulus.

$remainder= $time % 1; // $time = 5.1, $remainder = .1
$minutes = $remainder * 10 * 6;

I looked for modulus, couldn’t find it (I was expecting something like mod() … )

:slight_smile: for a reference http://php.net/manual/en/language.operators.arithmetic.php