-3

First array:

$Array['product'] = array('staff' => 'abc','services' => 0, 'products' => 100, 'total_sales' => 0)

Second array:

$Array['product'] = array('staff' => 'abc','services' => 150, 'products' => 0, 'total_sales' => 0)

I want the final result as:

$array['total'] = array('staff' => 'abc','services' => 150, 'products' => 100, 'total_sales' => 0)
Tim Lewis
  • 27,813
  • 13
  • 73
  • 102
  • 1
    what have you tried so far? – Marcin Orlowski Nov 24 '22 at 15:00
  • 4
    *"I want ..."* - Is not a question. What have you tried? Where are you stuck? Please [edit your question](https://stackoverflow.com/posts/74562692/edit) with your own attempts, including any errors you've encountered. – Tim Lewis Nov 24 '22 at 15:05

1 Answers1

0

You can use array_merge()

$array['total'] = array_merge($Array['product1'], $Array['product2']);
Searle
  • 54
  • 1
  • 9