new DateTime() vs new DateTime('NOW') in php

datetime, php

Solution

If you'll look into `DateTime` constructor definition you'll see that `now` is default value for initializing string:

public DateTime::__construct() ([ string $time = "now" [, DateTimeZone $timezone = NULL ]] )

That means both two calls above are always equal. If you'll not specify anything as initializing string, PHP will substitute `now` implicitly for you.

Problem

Before I post this question, I searched in several places for answer for this. I really could not find the proper answer. I evaluated the both way following... ``` $date = new DateTime() ``` amd ``` $date = new DateTime('NOW') ``` Is it must for the both above give the same result or is there any circumstance they both differ?

Original source