在我的脚本中找到一些代码,该代码由于已被贬值而每次循环都使用一段时间,因此会导致问题。
function obj2array ( $Instance ) {
$clone = (array) $Instance;
$rtn = array ();
$rtn['___SOURCE_KEYS_'] = $clone;
while ( list ($key, $value) = each ($clone) ) {
$aux = explode ("\0", $key);
$newkey = $aux[count($aux)-1];
$rtn[$newkey] = &$rtn['___SOURCE_KEYS_'][$key];
}
return $rtn;
}
是否将这个代码功能完全替换为旧的代码功能,从而产生相同的结果?
function obj2array ( $Instance ) {
$clone = (array) $Instance;
$rtn = array ();
$rtn['___SOURCE_KEYS_'] = $clone;
foreach ($clone as $key => $value) {
$aux = explode ("\0", $key);
$newkey = $aux[count($aux)-1];
$rtn[$newkey] = &$rtn['___SOURCE_KEYS_'][$key];
}
return $rtn;
}