我有這樣的代碼:如何按值複製對象/克隆對象在PHP 5
foreach ($this->configObjects as $k=>$object)
{
$configObject=$object;
//Here I will make a lot of changes to $configObject, however
// I want all those changes to be kept only to the local copy of $configObject,
// So the next time this foreach loop is run $this->configObjects array will contain
// a clean slate of configObject objects which don't have any traces of any
// earlier changes that were made to them
}
我怎樣才能做到這一點?
我不確定這是否適用於PHP 5以及不 – 2009-08-26 01:29:53