Array
(
[month] => FEBRUARY
[year] => 2018
[org] => 40
[action] => 4
)
Array
(
[month] => FEBRUARY
[year] => 2018
[org] => 41
[action] => 5
)
both have same content so how to merge this both so that i wil get data like this:
{"month":"FEBRUARY","year":"2018","org":"40,41","action":"4,5"}
Code:-
$query1 = $this->db->query($queryString);
$children = array();
$yearArray = array();
foreach ($query1->result() as $data1)
{
$yearArray['month'] = $data1->months;
$yearArray['year'] = $data1->PAY_YEAR;
$yearArray['org'] = $data1->org;
$yearArray['action'] = $data1->action;
print_r($result);
array_push($children, $yearArray);
}
with above code i am getting this json but i want to change its format as i said earlier in question:
{"month":"FEBRUARY","year":"2018","org":"40","action":"4"},{"month":"MARCH","year":"2018","org":"40","action":"5"}
I want to change about output with this actually:
{"month":"FEBRUARY","year":"2018","org":"40,41","action":"4,5"}