3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { var $dateTime; var $string; public function __construct() { $this->dateTime = new \DateTime(); $this->string = 'foo'; } } $obj1 = new Foo(); $obj2 = clone $obj1; $obj1->string = 'foo bar'; $obj1->dateTime->add(new \DateInterval('P1D')); var_dump($obj1, $obj2);

preferences:
49.42 ms | 402 KiB | 5 Q