3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements \Serializable { public $default = 10; public $setMe; private $test = 1; public $removeOnSerialize = 'blah'; public function serialize() { unset($this->removeOnSerialze); return serialize($this->getData()); } public function unserialize($serialized) { foreach (unserialize($serialized) as $key => $value) { $this->$key = $value; } $this->removeOnSerialize = 'Set some value'; } protected function getData() { return (array)$this; } } $obj = new Foo(); $obj->setMe = 9999; print_r($obj); // here I have all as exepcted $serialized = serialize($obj); $unserialized = unserialize($serialized); print_r($unserialized);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Foo implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /in/mqijs on line 3 Foo Object ( [default] => 10 [setMe] => 9999 [test:Foo:private] => 1 [removeOnSerialize] => blah ) Fatal error: Uncaught Error: Cannot access property starting with "\0" in /in/mqijs:19 Stack trace: #0 [internal function]: Foo->unserialize('a:4:{s:7:"defau...') #1 /in/mqijs(37): unserialize('C:3:"Foo":100:{...') #2 {main} thrown in /in/mqijs on line 19
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:
61.46 ms | 402 KiB | 8 Q