title: Adding an array to an array in PHP
body: <p>used php for a while but cannot get what is going on here! I've tried <code>array_merge()</code> and <code>array_push()</code> on an array to be able to add arrays to an array of existing arrays.</p>
  <p>For example, to be able to add x and y into the same array using a loop:</p>
  <pre><code>$x = [x, y, z];
  $y = [a, b, c];
  
  $goal = [[x, y, z], [a,b,c]];
  </code></pre>
  <p>Feel like I am so dinged up on this problem I am missing something really obvious!
  I've tried all of the following but have had nothing work.</p>
  <pre><code>$intermediate = array([x,y,z];;
  $goal = array($goal, $intermediate)
  
  $goal[$i] = $intermediate;
  
  $goal[$i][$j] = $raw[i][j]; // lets say raw is where elements come from
  </code></pre>
  <p>From what I have seen this is an indexed array that is multidimensional but I am completely stuck as I have been working it for hours! Any help appreciated!</p>
  <p>[EDIT] Essentially I am trying to push into Google sheets and it accepts input of the form <code>[[$val1], [$val2]]</code> for an insertion for two columns and of the form <code>[[$val1, $val2]]</code> for an insertion into a row.</p>
  <p>I have a 2d array, where each array will be a separate row but it doesn't seem to be working. I am updating $goal to $goal = [$goal, $intermediates] but it doesn't seem to work - it only keeps the first line.</p>
  <p>My goal is to push content of the form <code>[[$val1,$val2],[$val3,$val4]]</code> but it only inserts the <code>[$val1,$val2]</code> part.</p>
  <pre><code>$goal = [];
  for ($i = 0; $i &lt; count( $info) ; $i++){
    $value1 = $info[$i][0]; // fname
    $value2 = $info[$i][1]; // lname
    $value3 = $info[$i][2]; // age
  
    $person =[$value1, $value2, $value3];
  
  
    $goal = [$goal, $person];
   
  }
  </code></pre>
  <p>I have also tried with the array() version rather than the square brackets.</p>