How to pass multiple target_id/values field using entity reference prepopulate?
So if you want to create this link: node/add/page?field_bar=1,2,3

You need to put a comma between each nid, so implode() is what you want.

E.g.

$l = l( t('Create Package'), 'node/add/package',   array('query' =&gt; array('field_product_food' =&gt; implode(',', $nids))  ));