3v4l.org

run code in 300+ PHP versions simultaneously
<?php class testClass_forSerialize implements Serializable { public function serialize() { static $count = 0; static $objectHashes = []; $ret = new \stdClass(); $serializedData = serialize($ret); $objectHash = spl_object_hash($ret); echo "loop $count: ObjectHash $objectHash Received: ".$serializedData."\n"; if (array_key_exists($objectHash, $objectHashes) == true) { echo "Object hash already exists - serialize is going to be sad.\n"; } $objectHashes[$objectHash] = $count; if (@unserialize($serializedData) === false) { printf( "borked, serialize of %s returned %s which could not be unserialized.\n", var_export($ret, true), $serializedData ); exit(0); } echo "loop $count: Returning '$serializedData'\n"; $count++; return $serializedData; } public function unserialize($data) { throw new \Exception("not relevant"); } } $list = []; for ($i=0; $i<2; $i++) { $list[] = new \testClass_forSerialize(); } $ser = serialize($list);
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/9ttkq on line 3 loop 0: ObjectHash 00000000000000030000000000000000 Received: O:8:"stdClass":0:{} loop 0: Returning 'O:8:"stdClass":0:{}' loop 1: ObjectHash 00000000000000040000000000000000 Received: O:8:"stdClass":0:{} loop 1: Returning 'O:8:"stdClass":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:
56.13 ms | 402 KiB | 8 Q