1

In this code

$start = $this->getStart();
var_dump($start);
$start->modify('Monday this week');
var_dump($this->getStart());

-

public function getStart()
{
    return $this->start;
}

how is it possible, that the second dump actually shows the modified date?

I know that modify operates on the date object itself and not merely returns the new value. But why is the actual object property changed? When I change the value otherwise, e.g.

$start = $this->getStart();
var_dump($start);
$start = false;
var_dump($this->getStart());

two times the same date is dumped, as I would expect.

skymeissner
  • 228
  • 1
  • 9
  • `$start` is a data member of some class. You can not modify it directly. Add code of `modify()` also. – Sougata Bose Aug 24 '15 at 10:15
  • The problem is the othert way around! If I modify $start, the member actually IS modified also! This is the weird thing that I'm asking about... – skymeissner Aug 25 '15 at 10:05

0 Answers0