I have problem to add array into array. I cannot resolve it.
I have this array $A:
Array
(
[1001] => Array
(
[0] => Array
(
[name] => 'Joe'
[surname] => 'Doe'
[age] => 20
[height] => 180
[weight] => 80
)
)
)
And I have this array $B:
Array
(
[height] => 200
[weight] => 100
)
How to create new array to get this result:
Array
(
[1001] => Array
(
[0] => Array
(
[name] => 'Joe'
[surname] => 'Doe'
[height] => 180
[weight] => 80
[age] => 20
)
)
[1001] => Array
(
[1] => Array
(
[name] => 'Joe2'
[surname] => 'Doe2'
[height] => 200
[weight] => 100
[age] => 22
)
)
)
I use this, but the result is not correct:
$array[1001][] = [
'name' => 'Joe2',
'surname'=> 'Doe2',
$B,
'age' => 22
];
Thank you for answer.