由於標題摘要,我有一個函數,我對數組做了一些更改(這個數組是我的參數)。然後我意識到我使用了我的實際數組的副本。如何獲得實際變量,而不是使用函數時的副本
我知道有一種方法來獲得實際的數組而不是副本,它是什麼? 謝謝大家提前,我知道你會在一個瞬間:)解決這個
這裏是我用它
function findChildren($listOfParents)
{
static $depth=-1;
$depth++;
foreach ($listOfParents as $thisParent)
{
$thisParent->title = str_repeat(" >", $depth) . $thisParent->title;
$children = page::model()->findAll(array('condition'=>'parent = ' . $thisParent->id));
findChildren($children);
}
$depth--;
}
所以我需要這個$ listOfParents,不是他的副本。
謝謝,它幫助:) – Jordashiro
不要忘記接受答案,當你可以:) – freshnode