The source code to convert hours, minutes, and seconds into the number of seconds is given below. The given program is compiled and executed successfully.
<?php
//PHP program to convert hours, minutes, and seconds
//into several seconds.
$hh = 1;
$mm = 48;
$ss = 50;
$seconds = $hh * 3600 + $mm * 60 + $ss;
print ("Number of seconds: " . $seconds);
?>
Output:
Number of seconds: 6530
Explanation:
In the above program, we created three variables $hh, $mm, and $ss that are initialized with 1, 48, and 50 respectively. Then we calculated the number of seconds and printed the result on the console screen.
Program/Source Code:
The source code to convert hours, minutes, and seconds into the number of seconds is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we created three variables $hh, $mm, and $ss that are initialized with 1, 48, and 50 respectively. Then we calculated the number of seconds and printed the result on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer