我有这样的代码:如何按值复制对象/克隆对象在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