3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public $a; protected $b; private $c; public function __construct() { $this->a = 'A_a'; $this->b = 'A_b'; $this->c = 'A_c'; } } class B extends A { public $b; private $c; public function __construct() { parent::__construct(); $this->b = 'B_b'; $this->c = 'B_c'; } } $b = new B; var_dump($b); $array = (array) $b; var_dump($array);
Output for 5.6.30, hhvm-3.15.4 - 3.22.0, 7.0.0 - 7.3.0rc3
object(B)#1 (4) { ["b"]=> string(3) "B_b" ["c":"B":private]=> string(3) "B_c" ["a"]=> string(3) "A_a" ["c":"A":private]=> string(3) "A_c" } array(4) { ["b"]=> string(3) "B_b" ["Bc"]=> string(3) "B_c" ["a"]=> string(3) "A_a" ["Ac"]=> string(3) "A_c" }