-2

I have this arrays: Array ( [0] => 1 ) Array ( [0] => 1) Array ( [0] => 1 )

I want join to one array and result equal : Array ( [0] => 1 , [1] => 1 , [2] => 1 )

  • 1
    What have you tried so far? Did you search PHP.net, Google, StackOverflow? If you look through the array_ functions on PHP.net, do you find something that will do what you want? Your example is confusing because every array has a 1 in it, so we don't know if you want the same order or not, you're better to come up with a unique example. ie ['A'], ['B'], ['C'], and you want ['A', 'B', 'C'], not [1], [1], [1] and you want [1, 1, 1] because we can't tell if order is important. Suggest you look at `array_merge()` – gingerCodeNinja Feb 26 '20 at 23:06

1 Answers1

0

Are you looking for array_merge?

$arr1 = array(1);
$arr2 = array(2);
$arr3 = array(3);

$arr_all = array_merge($arr1, $arr2, $arr3);

Output:

array(3) {
  [0] => int(1)
  [1] => int(2)
  [2] => int(3)
}
Anis R.
  • 6,656
  • 2
  • 15
  • 37