3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements Serializable { public $obj; public function __construct( $obj ) { $this->obj = $obj; } public function serialize() { return serialize( array( 'obj' => $this->obj ) ); } public function unserialize( $s ) { $data = unserialize( $s ); $this->obj = $data['obj']; } } $obj = new stdclass; $foo1 = new Foo( $obj ); $foo2 = new Foo( $obj ); $s = serialize( array( $foo1, $foo2 ) ); var_dump( $s ); var_dump( unserialize( $s ) );
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/J6g8e on line 3 string(99) "a:2:{i:0;C:3:"Foo":35:{a:1:{s:3:"obj";O:8:"stdClass":0:{}}}i:1;C:3:"Foo":20:{a:1:{s:3:"obj";r:4;}}}" array(2) { [0]=> object(Foo)#4 (1) { ["obj"]=> object(stdClass)#5 (0) { } } [1]=> object(Foo)#6 (1) { ["obj"]=> object(stdClass)#5 (0) { } } }

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