@ 2015-09-11T06:56:58Z <?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);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught AssertionError: assert($clonedFoo->bar !== $foo->bar) in /in/NY7mp:25
Stack trace:
#0 /in/NY7mp(25): assert(false, 'assert($clonedF...')
#1 {main}
thrown in /in/NY7mp on line 25
Process exited with code 255 . Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.25 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 Warning: assert(): assert($clonedFoo->bar !== $foo->bar) failed in /in/NY7mp on line 25
Output for 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.28 Warning: assert(): Assertion failed in /in/NY7mp on line 25
preferences:dark mode live preview
218.46 ms | 402 KiB | 285 Q