title: PHP - How to unserialize data using ( UNSERIALIZE )
body: <p>Here is a code which serialize data and then unserialize it.</p>
  
  <pre><code> class magicmethod {
  protected $name = array('Arfan','Azeem','Haider');
  protected $fruit = array('Apple','Bannana');
  protected $animal = 'Cat';
  
  public function __sleep(){
      return array('name','animal');
  }
  
  public function __wakeup(){
      echo 'Going to Unserialized'; 
  }
    }
  
  $obj = new magicmethod;
  
  $ser = serialize($obj);
  
  var_dump($ser);
  
  var_dump(unserialize($ser));
  </code></pre>
  
  <p>I just serialize <code>$name</code> and <code>$animal</code> saved it in variable name <code>$ser</code>. After this 
  I unserialized this var <code>$ser</code> see that it unserialize all the class <code>magicmethod</code> it can also return the <code>fruit array</code> How it can do that I can not serilize all the class.<br>
  I want to get only those result which I serialized.</p>