3v4l.org

run code in 300+ PHP versions simultaneously
<?php class P { protected $a = 8; } class A extends P { public function see(B $b) { echo $b->a; } } class B extends P { } $obj = new A(); $b = new B(); $obj->see($b);
Output for 7.3.0 - 7.3.27, 7.4.0 - 7.4.16, 8.0.0 - 8.0.3
8