3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $a = 0; protected $b = true; public $c = 'hello'; } class Another extends Test { private $a = 1; protected $b = false; public $d ='wow'; } $obj = new Another(); $data = (array) $obj; $new = (object) $data; echo $new->c, $new->d, $new->b, $new->a; var_dump($data); var_dump($new);
Output for git.master, git.master_jit, rfc.property-hooks
hellowow Warning: Undefined property: stdClass::$b in /in/aFbJW on line 25 Warning: Undefined property: stdClass::$a in /in/aFbJW on line 25 array(5) { ["Testa"]=> int(0) ["*b"]=> bool(false) ["c"]=> string(5) "hello" ["Anothera"]=> int(1) ["d"]=> string(3) "wow" } object(stdClass)#2 (5) { ["a":"Test":private]=> int(0) ["b":protected]=> bool(false) ["c"]=> string(5) "hello" ["a":"Another":private]=> int(1) ["d"]=> string(3) "wow" }

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:
40.05 ms | 402 KiB | 8 Q