3v4l.org

run code in 300+ PHP versions simultaneously
<?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); foreach ($array as $k => $v) { var_dump([bin2hex($k), $k, $v]); }
Output for git.master, git.master_jit, rfc.property-hooks
object(B)#1 (4) { ["a"]=> string(3) "A_a" ["b"]=> string(3) "B_b" ["c":"A":private]=> string(3) "A_c" ["c":"B":private]=> string(3) "B_c" } array(4) { ["a"]=> string(3) "A_a" ["b"]=> string(3) "B_b" ["Ac"]=> string(3) "A_c" ["Bc"]=> string(3) "B_c" } array(3) { [0]=> string(2) "61" [1]=> string(1) "a" [2]=> string(3) "A_a" } array(3) { [0]=> string(2) "62" [1]=> string(1) "b" [2]=> string(3) "B_b" } array(3) { [0]=> string(8) "00410063" [1]=> string(4) "Ac" [2]=> string(3) "A_c" } array(3) { [0]=> string(8) "00420063" [1]=> string(4) "Bc" [2]=> string(3) "B_c" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
67.38 ms | 402 KiB | 8 Q