@ 2016-04-05T21:32:38Z <?php
class a
{
protected $aa = 1;
}
class b extends a
{
protected $aa = 10;
function foo()
{
$c = new c;
$c->foo($this);
}
}
class c extends a
{
function foo(b $b)
{
print_r($b->aa);
}
}
$b = new b;
$b->foo();
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.4.12 10 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 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.33 , 8.2.0 - 8.2.29 , 8.3.0 - 8.3.25 , 8.4.1 - 8.4.11 Fatal error: Uncaught Error: Cannot access protected property b::$aa in /in/abVRT:21
Stack trace:
#0 /in/abVRT(13): c->foo(Object(b))
#1 /in/abVRT(26): b->foo()
#2 {main}
thrown in /in/abVRT on line 21
Process exited with code 255 . Output for 5.5.0 - 5.5.36 , 5.6.0 - 5.6.28 Fatal error: Cannot access protected property b::$aa in /in/abVRT on line 21
Process exited with code 255 . preferences:dark mode live preview ace vim emacs key bindings
119.44 ms | 408 KiB | 5 Q