3v4l.org

run code in 200+ PHP versions simultaneously
<?php class Foo { public $prop; } $foo = new Foo(); $str = 'abc'; // $str is a string $foo->prop = &$str; var_dump($foo->prop); // "abc" $arr = array(); $foo->prop = $arr; var_dump($foo->prop); // array() var_dump($str); // array() - surprise! $str is now an array
based on gqQur
Output for 7.1.25 - 7.4.0rc2
string(3) "abc" array(0) { } array(0) { }