__wakeup() is called by unserialize(). : __wakeup « Class « PHP






__wakeup() is called by unserialize().

 
<?
class apple {
  var $frozen = 0;
  function ___sleep( ) {
    $this->frozen++;
    return array_keys( get_object_vars( $this) );
  }
  function __wakeup( ) {
      print $this->frozen." time(s)";
  }
}
$app = new apple ( );
$stored = serialize( $app );
print $stored;
$new_app = unserialize( $stored );

?>
  
  








Related examples in the same category

1.Using __sleep() and __wakeup() for Objects