I want to modify a big array inside a function, so I'm pretty sure I need to use references there, but I'm not sure what of these two alternatives is better (more performant, but also maybe some side effects?):

```
$array1 = getSomeBigArray();
$array2 = getAnotherBigArray();
$results[] = combineArrays($array1, $array2);

function combineArrays(&$array1, $array2){
   // this is not important, just example of modification
   foreach($array2 as $value){
      if($value > 0){
         $array1[] = $value;
      }
   }
   return $array1;    // will returning $array1 make a copy?
}

```

Option 2:

```
$array1 = getSomeBigArray();
$array2 = getAnotherBigArray();
combineArrays($array1, $array2);
$results[] = $array1;

function combineArrays(&$array1, $array2){

   foreach($array2 as $value){
      if($value > 0){
         $array1[] = $value;
      }
   }
   // void function
}

```

**EDIT:**
I have run some tests and now I'm more confused.  

This is the test:  

<https://ideone.com/v7sepC>  

From those results it seems to be faster to not use references at all! and if used is faster option1 (with return).  

But in my local env using references seems to be faster (not so much).

**EDIT 2:**  

Maybe there is a problem with ideone.com? because running the same here:  

<https://3v4l.org/LaffP>  

the result is:
Opcion1 and Option2 (references) are almost equal and faster than passing by value