If $total_months has a value of 13, what does $message contain after this if statement is executed?

If $total_months has a value of 13, what does $message contain after this if statement is executed?



Answer:

$years = $total_months/12;
$years = number_format($years);
$months = $total_months % 12:
if ( $years == 0 ) {
$messgae = $months . "months";
} else if ( $months == 0 ) {
$messgae = $years . "years";
} else {
$message = $years . "years, and " . $months . " months";
}
1 years, and 1 months


Learn More :