3v4l.org

run code in 300+ PHP versions simultaneously
<?php class testClass_forSerialize implements Serializable{ public function serialize() { // use array instead of stdClass $ret = Array(); foreach($this as $k=>$v){ if ($v!==null) { $ret[$k] = $v; } } $serializedData = serialize($ret); if (unserialize($serializedData)===false) { var_dump($serializedData); throw new \Exception("Serialize failed"); } return $serializedData; } public function unserialize($data) { $dataObj = unserialize($data); foreach($dataObj as $k=>$v) { $this->{$k} = $v; } } } class testClass_forSerialize_02 extends \testClass_forSerialize{ public $list = Array(); public function __construct() { for ($i=0; $i<10; $i++) { $this->list[] = new \testClass_forSerialize(); } } } $obj = new \testClass_forSerialize_02(); $ser = serialize($obj); $obj2 = unserialize($ser);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: testClass_forSerialize 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/hIJE9 on line 2 Deprecated: testClass_forSerialize_02 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/hIJE9 on line 33

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:
50.9 ms | 402 KiB | 8 Q