3v4l.org

run code in 300+ PHP versions simultaneously
<?php class HelloWorld implements Serializable { public $test; public function __construct($str) { $this->test = $str; } public function serialize() { $simple = null; $simple = new Simple(); $simple->test = $this->test; return serialize($simple); } public function unserialize($str) { $simple = unserialize($str); $this->test = $simple->test; } } class Simple { public $test; } $list = array( new HelloWorld('str1'), new HelloWorld('str2'), new HelloWorld('str3'), new HelloWorld('str4'), new HelloWorld('str5'), new HelloWorld('str6'), new HelloWorld('str7'), new HelloWorld('str8'), new HelloWorld('str9'), ); $str = serialize($list); echo $str; ?>

preferences:
42.09 ms | 402 KiB | 5 Q