3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Bar { public $bar; } class Foo { /** * @var Bar */ public $bar; } $bar = new Bar(); $bar->bar = 'BAR'; $foo = new Foo(); $foo->bar = $bar; $clonedFoo = clone($foo); assert($clonedFoo !== $foo); assert($clonedFoo->bar !== $foo->bar);
Output for 7.0.0 - 7.2.0
Warning: assert(): assert($clonedFoo->bar !== $foo->bar) failed in /in/NY7mp on line 25
Output for 5.4.0 - 5.6.28
Warning: assert(): Assertion failed in /in/NY7mp on line 25