3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait DependencySerializationTrait { public function __sleep() { return array_keys(get_object_vars($this)); } } abstract class Base { use DependencySerializationTrait; } class Test extends Base { private $something; public function __construct() { $this->something = 'test'; } public function getSomething() { return $this->something ?? 'NULLSAD'; } } class TestV2 { private $something; public function __construct() { $this->something = 'yay!'; } public function getSomething() { return $this->something ?? 'NULLSAD'; } public function __sleep() { return array_keys(get_object_vars($this)); } } $foo = new Test(); $blob = serialize($foo); $un_foo = unserialize($blob); echo $un_foo->getSomething(); echo "\n"; $bar = new TestV2(); $blob = serialize($bar); $un_bar = unserialize($blob); echo $un_bar->getSomething();
Output for git.master, git.master_jit, rfc.property-hooks
NULLSAD yay!

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:
184.59 ms | 405 KiB | 5 Q