Home > Mobile >  How to get data in a single array
How to get data in a single array

Time:02-05

How can i get this data in a single array using loop?

Array ( [0] => 1,2,1,23,5,2 [1] => 1,1,1,2,3,2 [2] => 2,3,4 [3] => 1,2,3 [4] => 1,2,3,4 [5] => 1,2,3,10 [6] => 1,2,3,4 [7] => 1,2,3 [8] => 3,2,2 )

CodePudding user response:

You can use this:

$array = array_values($array);

It a use of array_values function:

CodePudding user response:

you can do it without loop

$flattenArray = array_merge([], ...$arrays);

use array_unique() to remove duplicate values

  •  Tags:  
  • Related