let's say if I have an array like this below.
$i = array(
'arr1' => array(
'a11' => 'ar11',
'a12' => 'ar12',
),
'arr2' => array(
'a21' => 'ar21',
'a22' => 'ar22',
'a23' => 'ar23',
),
'arr3' => 'arrr3',
'arr4' => 'arrr4'
);
I want a new array that created from this array like the one I mentioned below,
$j = array(
'a11' => 'ar11',
'a12' => 'ar12',
'a21' => 'ar21',
'a22' => 'ar22',
'a23' => 'ar23',
'arr3' => 'arrr3',
'arr4' => 'arrr4'
);
sofar I tried extracting the last two elements which aren't arrays I mention the code below
$ii = $i;
foreach($ii as $k => $v):
if(is_array($v)):
unset($ii[$k]);
endif;
endforeach;
this returns me the last two elements. but the way i tried extracting the other elements looks wired see below.
$i1 = $i['arr1'];
$i2 = $i['arr2'];
$i3 = array_merge($i1, $i2);
$final = array_merge($i3, $j);
this looks simple because it has small amout of elemetns but i have large amount of elements in my project, any other ways to get this output?