__sleep() and superclass properties [closed]

Kn3d3ls

New Member
Given two classes:\[code\]class A{ private $prop1;}class B extends A{ private $prop2; public function __sleep() { return array('prop1','prop2'); }}\[/code\]That will only serialize the value of \[code\]prop2\[/code\] as it's a direct property of class B.How can I get it to output the inherited \[code\]prop1\[/code\] from superclass A?EDIT:
Not defining the __sleep() will show the \[code\]private\[/code\] properties in the serialized string without setting them to \[code\]protected\[/code\]. They look something like \[code\]?A?prop1\[/code\], only I cannot get what the ? is.
 
Top