@ 2013-12-09T13:17:28Z <?php
class Foo
{
public function & bar()
{
return $this->var = $var = $this->baz();
}
public function baz()
{
return 'hello';
}
}
$foo = new Foo();
$var = $foo->bar();
var_dump($var);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.2.0 - 8.2.18 , 8.3.0 - 8.3.7 Deprecated: Creation of dynamic property Foo::$var is deprecated in /in/VW9aB on line 9
Notice: Only variable references should be returned by reference in /in/VW9aB on line 9
string(5) "hello"
Output for 5.3.0 - 5.3.29 , 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.31 , 7.4.0 - 7.4.25 , 7.4.27 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 Notice: Only variable references should be returned by reference in /in/VW9aB on line 9
string(5) "hello"
Output for 7.3.32 - 7.3.33 , 7.4.26 string(5) "hello"
Output for 5.5.0 - 5.5.38 Fatal error: Cannot return string offsets by reference in /in/VW9aB on line 9
Process exited with code 255 . Output for 5.4.0 - 5.4.45 Process exited with code 139 . preferences:dark mode live preview
244.96 ms | 401 KiB | 405 Q