title: How to store multiple arrays as one array, with array_unshift & array_merge
body: <h2>a better clarification version</h2>
  
  <pre><code>$x = ['x', 'y', 'z'];
  $a = ['a', 'b', 'c'];
  $array = array_merge($x, $a);
  print_r($array);
  </code></pre>
  
  <p>is working perfectly and giving me the following array</p>
  
  <pre><code>Array ( [0] =&gt; x [1] =&gt; y [2] =&gt; z [3] =&gt; a [4] =&gt; b [5] =&gt; c )
  </code></pre>
  
  <p>But i have a statement like this <strong>[WHICH IS TOTALLY WRONG AT THE MERGE PART]</strong></p>
  
  <pre><code>$x = ['x', 'y', 'z'];
  if(isset($_GET['z'])){
     $a = ['a', 'b', 'c'];
  }
  $array = array_merge($x, $a); //need to assign that to a variable!
  print_r($array);
  </code></pre>
  
  <p>But i can't add the $a like this into the <code>array_merge()</code>so i assign them to a variable like the following</p>
  
  <pre><code>$x = ['x', 'y', 'z'];
  if(isset($_GET['z'])){
     $a = ['a', 'b', 'c'];
  }
  $merging = [$x];
  if(isset($_GET['z'])){
      array_unshift($merging, $a);
  }
  $array = array_merge($merging);
  print_r($array);
  </code></pre>
  
  <p>But what i get is </p>
  
  <pre><code>Array ( 
  [0] =&gt; Array ( [0] =&gt; a [1] =&gt; b [2] =&gt; c ) 
  [1] =&gt; Array ( [0] =&gt; x [1] =&gt; y [2] =&gt; z ) 
  )
  </code></pre>
  
  <p>And what i want is one single array containing all the values like the first example array.</p>
  
  <p>In case <code>$_GET['z']</code> exists, I want to get the values </p>
  
  <pre><code>Array ( [0] =&gt; a [1] =&gt; b [2] =&gt; c [3] =&gt; x [4] =&gt; y [5] =&gt; z )
  </code></pre>
  
  <p>And in case <code>$_GET['z']</code> doesn't exist, I want these values only</p>
  
  <pre><code>Array ( [0] =&gt; x [1] =&gt; y [2] =&gt; z )
  </code></pre>