3v4l.org

run code in 200+ PHP versions simultaneously
<?php $o= new stdclass; $o->a= 'b'; $o->b= 'c'; $o2= $o; $o2->a= 'd'; var_dump($o); var_dump($o2); $o2->b = 'foo'; var_dump($o); var_dump($o2); $o3= clone $o; $o3->a= 'e'; var_dump($o); var_dump($o3);
Output for 7.1.0 - 7.4.1
object(stdClass)#1 (2) { ["a"]=> string(1) "d" ["b"]=> string(1) "c" } object(stdClass)#1 (2) { ["a"]=> string(1) "d" ["b"]=> string(1) "c" } object(stdClass)#1 (2) { ["a"]=> string(1) "d" ["b"]=> string(3) "foo" } object(stdClass)#1 (2) { ["a"]=> string(1) "d" ["b"]=> string(3) "foo" } object(stdClass)#1 (2) { ["a"]=> string(1) "d" ["b"]=> string(3) "foo" } object(stdClass)#2 (2) { ["a"]=> string(1) "e" ["b"]=> string(3) "foo" }