3v4l.org

run code in 500+ PHP versions simultaneously
<?php class ReadonlyWakeupWithReflection { public function __construct(public readonly string $value) {} public function __wakeup(): void { (new \ReflectionProperty($this, 'value'))->setValue($this, 'set by reflection on wakeup'); } } $obj = new ReadonlyWakeupWithReflection('test'); $serialized = serialize($obj); $unserialized = unserialize($serialized); print $unserialized->value;
Output for git.master_jit, git.master
Fatal error: Uncaught Error: Cannot modify readonly property ReadonlyWakeupWithReflection::$value in /in/3mViB:7 Stack trace: #0 /in/3mViB(7): ReflectionProperty->setValue(Object(ReadonlyWakeupWithReflection), 'set by reflecti...') #1 [internal function]: ReadonlyWakeupWithReflection->__wakeup() #2 /in/3mViB(13): unserialize('O:28:"ReadonlyW...') #3 {main} thrown in /in/3mViB on line 7
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:
43.3 ms | 723 KiB | 4 Q