Reply to Re: storing classes

Your name:

Reply:


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";}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация