3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Permission implements \Serializable { protected $id = 3; public function serialize() { return serialize(array($this->id)); } public function unserialize($serialized) { list($this->id) = unserialize($serialized); } } class UserPermission implements \Serializable { public $permission; public $webshop; public function serialize() { return serialize(array($this->webshop, $this->permission)); } public function unserialize($serialized) { list($this->webshop, $this->permission) = unserialize($serialized); } } class Webshop implements \Serializable { protected $id = 0xAAAAAAAAAAAAAAAA; public function serialize() { return serialize(array($this->id)); } public function unserialize($serialized) { list($this->id) = unserialize($serialized); } } class AbstractToken implements \Serializable { public $roles; public function serialize() { return serialize(array($this->roles)); } public function unserialize($serialized) { list($this->roles) = unserialize($serialized); } } class UsernamePasswordToken extends AbstractToken { private $credentials = null; private $providerKey = null; public function serialize() { return serialize(array($this->credentials, $this->providerKey, parent::serialize())); } public function unserialize($str) { list($this->credentials, $this->providerKey, $parentStr) = unserialize($str); parent::unserialize($parentStr); } } $token = new UsernamePasswordToken(); $webshop = new Webshop; $permission = new Permission; $roles = array(); for ($i = 0; $i < 2; $i++) { $roles[$i] = new UserPermission(); $roles[$i]->webshop = $webshop; $roles[$i]->permission = $permission; } $token->roles = $roles; var_dump(unserialize(serialize($token)));
Output for git.master, git.master_jit
Deprecated: Permission 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/OL0gW on line 2 Deprecated: UserPermission 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/OL0gW on line 15 Deprecated: Webshop 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/OL0gW on line 29 Deprecated: AbstractToken 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/OL0gW on line 42 Deprecated: UsernamePasswordToken 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/OL0gW on line 55 Notice: unserialize(): Error at offset 13 of 22 bytes in /in/OL0gW on line 25 object(UsernamePasswordToken)#6 (3) { ["roles"]=> array(2) { [0]=> object(UserPermission)#7 (2) { ["permission"]=> object(Permission)#9 (1) { ["id":protected]=> int(3) } ["webshop"]=> object(Webshop)#8 (1) { ["id":protected]=> float(1.2297829382473034E+19) } } [1]=> object(UserPermission)#10 (2) { ["permission"]=> NULL ["webshop"]=> NULL } } ["credentials":"UsernamePasswordToken":private]=> NULL ["providerKey":"UsernamePasswordToken":private]=> NULL }
Output for rfc.property-hooks
Deprecated: Permission 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/OL0gW on line 2 Deprecated: UserPermission 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/OL0gW on line 15 Deprecated: Webshop 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/OL0gW on line 29 Deprecated: AbstractToken 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/OL0gW on line 42 Deprecated: UsernamePasswordToken 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/OL0gW on line 55 Warning: unserialize(): Error at offset 13 of 22 bytes in /in/OL0gW on line 25 object(UsernamePasswordToken)#6 (3) { ["roles"]=> array(2) { [0]=> object(UserPermission)#7 (2) { ["permission"]=> object(Permission)#9 (1) { ["id":protected]=> int(3) } ["webshop"]=> object(Webshop)#8 (1) { ["id":protected]=> float(1.2297829382473034E+19) } } [1]=> object(UserPermission)#10 (2) { ["permission"]=> NULL ["webshop"]=> NULL } } ["credentials":"UsernamePasswordToken":private]=> NULL ["providerKey":"UsernamePasswordToken":private]=> NULL }

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:
40.31 ms | 404 KiB | 8 Q