Here I want to create an array for query string like given below:
item[]['item_id']=I00001&item[]['rate']=10.52&item[]['qty']=2&
item[]['item_id']=I52124&item[]['rate']=15.00&item[]['qty']=1&
item[]['item_id']=I62124&item[]['rate']=8.20&item[]['qty']=5
I want to generate it dynamically.
for($i = 0 ; $i< count($allitems) ;$i++){
$itemid = explode('~',$allitems[$i]);
$arrdet[]=["'item_id'"=>$itemid[0],"'rate'"=>$itemid[1],"'qty'" =>$itemid[2]];
$item['item'] = array_merge($arrdet);
//$item['item'][]=["'item_id'"=>$itemid[0],"'rate'"=>$itemid[1],"'qty'" =>$itemid[2]];
}
echo http_build_query($item);
but my result for this
item[0]['item_id']=I00001&item[0]['rate']=10.52&item[0]['qty']=2&
item[1]['item_id']=I52124&item[1]['rate']=15.00&item[1]['qty']=1&
item[2]['item_id']=I62124&item[2]['rate']=8.20&item[2]['qty']=5
How it Possible? Thanks in advance