Question: Code example 1: $current_date = new DateTime(); $due_days_diff = $current_date->diff($due_date); if ($current_date > $due_date) { $overdue_message = $due_days_diff->format( '%y years, %m months, and %d days

Code example 1:

$current_date = new DateTime();

$due_days_diff = $current_date->diff($due_date);

if ($current_date > $due_date) {

$overdue_message = $due_days_diff->format(

'%y years, %m months, and %d days overdue.');

}

Questions:

1-. (Refer to code example 1) If $due_date contains a DateTime object, $due_date_diff will contain

a.

a TimeStamp object

b.

a DateTime object

c.

a DateInterval object

d.

a TimeInterval object

2. (Refer to code example ) If $due_date contains a DateTime object for a date that comes 1 month and 7 days before the date stored in the $current_date variable, what will $overdue_message contain when this code finishes executing:

a.

0 years, 1 months, and 7 days overdue.

b.

-0 years, -1 months, and -7 days overdue.

c.

1 month and 7 days overdue.

d.

$overdue_message wont be set because the if clause wont be executed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!