2 ion\serialize/serializable
8 class test implements Serializable {
10 function serialize() : string {
13 function unserialize(string $data) : void {
18 $s = ion\serialize($t);
20 $c = ion\unserialize($s);
23 class recursive implements Serializable {
29 function serialize() : string {
31 return "node:" . ion\serialize($this->r);
36 function unserialize(string $data) : void {
37 if ($data === "leaf") {
40 $this->id = substr($data, 0, 4);
41 $this->r = ion\unserialize(substr($data, 5));
45 $tree = new recursive(new recursive(null));
47 $s = ion\serialize($tree);
49 var_dump(ion\unserialize($s));
55 Deprecated: test implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %sserialize/serializable.php on line %d
56 PHP::S::test::"foobar"
62 Deprecated: recursive implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %sserialize/serializable.php on line %d
63 object(recursive)#%d (2) {
64 ["id":"recursive":private]=>
67 object(recursive)#%d (2) {
68 ["id":"recursive":private]=>
74 PHP::S::recursive::"node:S::recursive::\"leaf\""
75 object(recursive)#%d (2) {
76 ["id":"recursive":private]=>
79 object(recursive)#%d (2) {
80 ["id":"recursive":private]=>