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?
Multiply it by 60. <?php $sum = round(11 / 55,1);// example 11 miles $cal = $sum * 60; echo $cal." minutes"; ?> PHP:
He only wanted to multiple the decimals not the whole number. <?php $sum = round(11 / 55,1);// example 11 miles $hours = floor($sum); $minutes = ($sum-hours) * 60; echo $hours. " hours and " .$minutes. " minutes"; ?> PHP:
No not sarcasm, I misread. Your code does output an error though, but the fixed code: <?php $sum = round(11 / 55,1);// example 11 miles $hours = floor($sum); $minutes = ($sum-$hours) * 60; echo $hours. " hours and " .$minutes. " minutes"; ?> PHP:
Sorry about that. oops I was testing my code with a fresh installation of xampp and it had error_display disabled.