3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class C { private $s; public function __construct($s) { $this->s = $s; } protected function getS() { return $this->s; } } class C1 extends C { public function __get($name) { $value = 'wanted:'.$name; $this[$name] = $value.',got it again'; return $value; } public function __construct($s1) { parent::__construct($s1); } function doStuff() { echo $this->getS(); echo $this->s; echo $this->s; } } $c1 = new C1('foo'); $c1->doStuff();
Output for git.master, git.master_jit, rfc.property-hooks
foo Fatal error: Uncaught Error: Cannot use object of type C1 as array in /in/KK2Kt:16 Stack trace: #0 /in/KK2Kt(24): C1->__get('s') #1 /in/KK2Kt(30): C1->doStuff() #2 {main} thrown in /in/KK2Kt on line 16
Process exited with code 255.

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:
48.29 ms | 401 KiB | 8 Q