php - Object pushed to array overites -
i've got strange thing, it's simple can't find solution it. here part of code:
$counter = 0; $autoload_view_instace = new logic_invoicecostdata; $sub_view_cost = array(); foreach($invocecostdata $data) { $counter++; $parm = $autoload_view_instace->edit_view_data($autoload_view, $data, $counter); array_push( $sub_view_cost, $parm); }
the loop calls edit_view_data
method returns object values. object should placed @ end of array in each iteration without changing values of objects added. after each iteration, objects in array have same value newly added object.
apparently array_push syntax correct.. , should work .. can same thing using. $sub_view_cost[]=$parm ;
and make sure each time $parm correct value
Comments
Post a Comment