title: Passing and using an array by reference in PHP
body: <p>In a PHP function, I'd like to append values to an array that was passed in by reference.  For example:</p>
  
  <pre><code>function foo(array &amp;$arr) {
      $arr[] = "error on this line";
      $arr[] = "more";
      $arr[] = "stuff";
  }
  </code></pre>
  
  <p>The error I get when I attempt to append something to the array is</p>
  
  <pre><code>PHP Parse error:  syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING in somefile.class.php on line xxx
  </code></pre>
  
  <p>I'm not sure I have the parameter defined correctly, or if this is even possible.  Googling has so far not turned up any comparable examples.</p>
  
  <p><strong>EDIT</strong>:  PHP Version 5.1.6.</p>