<?php
class x {
function __construct(){
$x=& $this;
$x = new y;
$this->bar();
}
function foo(){
$this->bar();
}
}
class y{
function bar(){
echo "bar";
}
}
$b=new x;
$b->foo();
Fatal error: Uncaught Error: Call to undefined method x::bar() in /in/CB6gd:6
Stack trace:
#0 /in/CB6gd(17): x->__construct()
#1 {main}
thrown in /in/CB6gd on line 6
Process exited with code 255.