0

how can i merge array inside multidimensional array, in this case i want to count all array inside then sum it, but i confuse how to merge or make an array like my code below

Array
(
    [0] => Array
        (
            [0] => 60-41109-50005
            [1] => 60-41109-50005
            [2] => 60-41109-50005
            [3] => 60-41109-50005
        )
    [1] => Array
        (
            [0] => 60-41109-50005
            [1] => 60-41109-50005
            [2] => 60-41109-50005
            [3] => 60-41109-50005
        )
)

i want create array like this so then i can count it

Array
(
  [0] => 60-41109-50005
  [1] => 60-41109-50005
  [2] => 60-41109-50005
  [3] => 60-41109-50005
  [4] => 60-41109-50005
  [5] => 60-41109-50005
  [6] => 60-41109-50005
  [7] => 60-41109-50005
)

**i hope anyone can help me, thanks**
  • yessss its solved, thanks @WillB. i use this $arr = array_reduce($cnt, function ($a, $b) { return array_merge($a, (array) $b); }, []); – Riki Kuswo Mar 19 '22 at 14:40

0 Answers0