__Sleep() Method Is Called By Serialize() Before It Packs Up The Object.

<?
class apple {
  var $flavor="sweet";
  var $frozen = 0;
  function ___sleep( ) {
    $this->frozen++;
    return array_keys( get_object_vars( $this) );
  }
}
$app = new apple ( );
$stored = serialize( $app );
print $stored;
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.