Intermediate PHP
Q86 / 100

What is PHP's DateTimeImmutable class?

Correct! Well done.

Incorrect.

The correct answer is B) An immutable DateTime class where modification methods return new instances instead of modifying in place

B

Correct Answer

An immutable DateTime class where modification methods return new instances instead of modifying in place

Explanation

Unlike DateTime::modify() which mutates, DateTimeImmutable::modify() returns a new object. Prevents accidental mutation in code that passes dates around.

Progress
86/100