i thought, that i understand what references do. but now i meet an example, which can't understand anyway.
i saw an interesting script here, but why he use &
in this script i can't understand.
here is the part of script
foreach ($nodeList as $nodeId => &$node)
{
if (!$node['id_parrent'] || !array_key_exists($node['id_parrent'], $nodeList))
{
$tree[] = &$node;
}
else
{
$nodeList[$node['id_parrent']]['children'][] =&$node;
}
}
if he doesn't make any changes on $node, why it is needed to use references here?
there is nothing like $node = any changes
, so why use =& $node, instead $node?
maybe you will help me to understand?
Thanks