Hi, I am sending a reference of an array variable which is initially empty. In the called function the array gets populated.
function one()
{
$ret = array();
two($ret);
pri nt_r($ret);
}
function two(&$res)
{
foreach($a as $b)
{
$id = $b->getid();
$txt = $b->gettxt();
$res[$id] = $txt;
}
}
Here, if $id is duplicated i assume that it is by default overwritten. That is if the foreach runs for 5 times and for three times if id=5 then the result is only two elements in the array;
Is this the default behavior for this kind of assignment of arrays? or am i missing something?