Calculate speed , distance and time | Function to calculate speed ; Function to calculate distance traveled ; Function to calculate time taken ; Calling function cal_speed ( ) ; Calling function cal_dis ( ) ; Calling function cal_time ( )
< ? php function cal_speed ( $ dist , $ time ) { echo " Distance ( km ) : " echo " Time ( hr ) : " return $ dist / $ time ; } function cal_dis ( $ speed , $ time ) { echo " Time ( hr ) : " echo " Speed ( km / hr ) : " return $ speed * $ time ; } function cal_time ( $ dist , $ speed ) { echo " Distance ( km ) : " echo " Speed ( km / hr ) : " return $ speed * $ dist ; } echo " ▁ The ▁ calculated ▁ Speed ( km ▁ / ▁ hr ) ▁ is ▁ : ▁ " . cal_speed ( 45.9 , 2.0 ) . " STRNEWLINE " ; echo " The calculated Distance ( km ) : " . cal_dis ( 62.9 , 2.5 ) . " " ; echo " The calculated Time ( hr ) : " . cal_time ( 48.0 , 4.5 ) . " " ; ? >