3v4l.org

run code in 500+ PHP versions simultaneously
<?php $info = new SplFileInfo( __FILE__ ); try { serialize($info); } catch (\Throwable $e) { echo $e . "\n\n\n"; } class MyFileInfo extends SplFileInfo { public function __serialize(): array { return [ 'file' => getPathname(), ]; } public function __unserialize(array $data) { $this->__construct($data['file']); } } $info2 = new MyFileInfo( __FILE__ ); try { $serialized = serialize($info2); $roundtrip = unserialize($serialized); var_dump($info2, $roundtrip); } catch (\Throwable $e) { echo $e . "\n"; }
Output for git.master_jit, git.master
Exception: Serialization of 'SplFileInfo' is not allowed in /in/SVqho:5 Stack trace: #0 /in/SVqho(5): serialize(Object(SplFileInfo)) #1 {main} Exception: Serialization of 'MyFileInfo' is not allowed in /in/SVqho:24 Stack trace: #0 /in/SVqho(24): serialize(Object(MyFileInfo)) #1 {main}

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:
49.29 ms | 546 KiB | 4 Q