Question: I am seeking for someone's knowledge out here.

Right now, I would need to merge several arrays into a bigger one, but all of those arrays depend on a function.

This function returns a numeric array containing different quantities of numbers between 1 and 7 :

```
function Possible($i, $j, $grid)
$possible = Possible($i, $j, $grid)

```

I'm working with a grid, and the function returns a different array for every case of the grid. What I would like to do is to merge those 7 arrays into another one. Some numbers may be present more than once in this big array, but I want it this way.

I tried using for loops, while loops and some other techniques, but nothing worked. In this case, it is not possible to manually define every array, since they change depending of what is contained in the grid and there are too many. It has to be done automatically, and this is where I get stuck.

```
for ($jj=0; $j<7; $j++){
    $possRow = array_merge( ###what do I add here or what do I change in this code to make everything work###

```

Thank you if someone can help me out!

Etpi

Answer: 
hope this help:

```
  $biggerOneArray = array();
    for($k=0;$k<7;$k++) {
     $biggerOneArray[] = Possible($i,$j,$grid);
}

```

Then you can check your bigger array, may contains all arrays of the iterations of the loop (7 arrays merged).

```
var_dump($biggerOneArray);

```

The output should be this:

```
array(
      (int) 0 => array(
           'key' => 'value',
           'key2' => 'value2'
           ),
      (int) 1 => array(
           'key3' => 'value3',
           'key4' => 'value4'
            )
)

```

etc...
I'm sorry but your description isn't very clear. But just to get you started you might look at this solution.

```
function Possible($i, $j, $grid) {
    // some code ... e.g. $array[] = "some data";

    return $array;
}

```

By creating a small array for each grid and returning it using `return $array` you get a few little arrays which you can inturn place into a `for` loop to merge it into one larger array. However i believe the var `$jj` must have some meaning in the function it self as well.

```
for($jj=0;$jj<7;$jj++) {
    $merged_array[$jj] = Possible($i,$j,$grid);
}

```

Maybe if you descripe your problem a little more and post an exmple of the array's your working with i can give you a better answer.