3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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->dateTime->format('Y-m-d')); var_dump($obj1->string); var_dump($obj2->dateTime->format('Y-m-d')); var_dump($obj2->string);
based on ABBFf
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
string(10) "2017-07-04" string(7) "foo bar" string(10) "2017-07-04" string(3) "foo"