| Posted by Carl Vondrick on 01/25/06 08:14 
Justin Koivisto wrote:> I haven't tried serializing objects in php, but I was just thinking that
 > in php5 because of the pass by reference default nature, you may have
 > difficulty with it if you aren't using the clone keyword...
 
 
 I just tried it out on my machine: it works as expected.
 
 <?php
 class MyObject
 {
 public $name;
 
 public function __construct()
 {
 $this->name = 'Carl';
 }
 }
 
 $a = new MyObject;
 $b = & $a;
 
 print serialize($b) . "\n" . serialize($a);
 ?>
 
 Returns:
 O:8:"MyObject":1:{s:4:"name";s:4:"Carl";}
 O:8:"MyObject":1:{s:4:"name";s:4:"Carl";}
  Navigation: [Reply to this message] |