3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyParentClass { public function getProperty($propertyName) { return $this->{$propertyName}; } public function setProperty($propertyName, $value) { $this->{$propertyName} = $value; return $this; } } class MyChildClass extends MyParentClass { protected $foo; private $bar; } $child = new MyChildClass(); $child ->setProperty('foo', 'lulu') ->setProperty('bar', true); var_dump( $child->getProperty('foo'), $child->getProperty('bar') );
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Cannot access private property MyChildClass::$bar in /in/WEYZ8:12 Stack trace: #0 /in/WEYZ8(27): MyParentClass->setProperty('bar', true) #1 {main} thrown in /in/WEYZ8 on line 12
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:
44.11 ms | 401 KiB | 8 Q