3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $a_private = 1; protected $a_protected = 2; public $a_public = 3; } class C extends A { private $c_private = 1; protected $c_protected = 2; public $c_public = 3; } class B extends A { private $b_private = 1; protected $b_protected = 2; public $b_public = 3; protected $sub; function __construct(){ $this->sub = new C(); } function __debugInfo(){ return ['foo'=>'bar']; } } function object_dump($object){ return (array)$object; } var_dump(object_dump(new B));
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
array(7) { ["Aa_private"]=> int(1) ["*a_protected"]=> int(2) ["a_public"]=> int(3) ["Bb_private"]=> int(1) ["*b_protected"]=> int(2) ["b_public"]=> int(3) ["*sub"]=> object(C)#2 (6) { ["a_private":"A":private]=> int(1) ["a_protected":protected]=> int(2) ["a_public"]=> int(3) ["c_private":"C":private]=> int(1) ["c_protected":protected]=> int(2) ["c_public"]=> int(3) } }
Output for 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.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
array(7) { ["Bb_private"]=> int(1) ["*b_protected"]=> int(2) ["b_public"]=> int(3) ["*sub"]=> object(C)#2 (6) { ["c_private":"C":private]=> int(1) ["c_protected":protected]=> int(2) ["c_public"]=> int(3) ["a_private":"A":private]=> int(1) ["a_protected":protected]=> int(2) ["a_public"]=> int(3) } ["Aa_private"]=> int(1) ["*a_protected"]=> int(2) ["a_public"]=> int(3) }

preferences:
112.39 ms | 2100 KiB | 4 Q