__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 );?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.