Hi friends.
I have been learning about objects as of late, and I am stumped/confused by something.
here is the code:
class User {
public function __wakeup() {
echo "Yawn... what’s for breakfast? <br/>";
}
}
$user = new User;
$userString = serialize( $user );
$obj = unserialize( $userString );
Simple enough, but what I don't understand is - why, when i run this line:
$obj = unserialize( $userString );
....... for some reason the value of:
"Yawn... what’s for breakfast?"
.... is outputted to my browser.
I don't understand why this would happen when $obj is a variable.
I haven't even used print_r() with the variable $obj to output the value $obj contains.
So why on earth is $obj echoing the value when at first glance it appears merely as a container of the value that is outputted?
Paul.