I have two arrays which I wish to combine so that name and value can be side by side.
I have this code:
$mgl = array(
'200101',
'200201',
'200202'
);
$mpro = array(
'Current Account',
'Regular Saving Account',
'Ileya Target'
);
array_push($response, array(
"glno"=>$mgl,
"product"=>$mpro
));
echo json_encode(array("server_response"=> $response));
When I viewed it it appeared this way:
{"server_response":[{"glno":["200101","200201","200202"],"product":["Current Account","Regular Saving Account","Ileya Target"]}]}
I want it in this format
{"server_response":[
{"glno":"104100","product":"Micro Loans"},
{"glno":"200101","product":"Current Account"},
{"glno":"200201","product":"Regular Saving Account"}
]}