-
-
Save kimjangwook/ee2f81c62036a659f7d002d3f46811db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
private $prop_a; | |
public function __serialize(): array { | |
return ["prop_a" => $this->prop_a]; | |
} | |
public function __unserialize(array $data) { | |
$this->prop_a = $data["prop_a"]; | |
} | |
} | |
class B extends A { | |
private $prop_b; | |
public function __serialize(): array { | |
return [ | |
"prop_b" => $this->prop_b, | |
"parent_data" => parent::__serialize(), | |
]; | |
} | |
public function __unserialize(array $data) { | |
parent::__unserialize($data["parent_data"]); | |
$this->prop_b = $data["prop_b"]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment