I am writing here because I amt totally confused of what the equal operator means for objects in php. I run the example bellow...
$currentDay = new DateTime();
$dayBefore = new DateTime();
$dayBefore = $currentDay;
$dayBefore->modify('-1 day');
$currentDay->modify('-1 month');
$dayBefore->modify('-1 year');
$currentDay->modify('-5 day');
echo 'Current day : ';
print_r($currentDay);
echo '<br />';
echo 'Day before : ';
print_r($dayBefore);
and the result is
<!-- Output -->
Current day : DateTime Object ( [date] => 2017-01-15 10:54:13 [timezone_type] => 3 [timezone] => Europe/Paris )
Day before : DateTime Object ( [date] => 2017-01-15 10:54:13 [timezone_type] => 3 [timezone] => Europe/Paris )
As you can see whatever operation is being applied to one of the dates, it is also being applied to the other one. So, are $dayBefore and $currentDay in some kind of synchronization? Or one of them is an alias of the other?