3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Ex extends \ReflectionException { public $reflector; public function __construct($reflector, $message = '', \Exception $previous = null) { parent::__construct($message, 0, $previous); $this->reflector = $reflector; } } class A { private $private = 'private'; public $public = 'public'; private function privateMethod() { } } class B { //public $private = 'pr'; private $public = 'pu'; } class C extends \ReflectionClass { public function __construct($name) { try { parent::__construct($name); } catch (\Exception $e) { throw new Ex($this, $e->getMessage(), $e); } } } $r = new \ReflectionClass('A'); $p = $r->getMethod('privateMethod'); $p->setAccessible(true); $p->setAccessible(false); //var_dump($p->invoke(new stdClass())); $p = $r->getProperty('public'); $p->setAccessible(false); var_dump($p->getValue(true));
Output for git.master, git.master_jit
Fatal error: Uncaught TypeError: ReflectionProperty::getValue(): Argument #1 ($object) must be of type ?object, bool given in /in/J9BU3:53 Stack trace: #0 /in/J9BU3(53): ReflectionProperty->getValue(true) #1 {main} thrown in /in/J9BU3 on line 53
Process exited with code 255.
Output for rfc.property-hooks
Fatal error: Uncaught TypeError: ReflectionProperty::getValue(): Argument #1 ($object) must be of type ?object, true given in /in/J9BU3:53 Stack trace: #0 /in/J9BU3(53): ReflectionProperty->getValue(true) #1 {main} thrown in /in/J9BU3 on line 53
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.6 ms | 401 KiB | 8 Q