title: How to pass an array into a function, and return the results with an array
body: <p>So I'm trying to learn how to pass arrays through a function, so that I can get around PHP's inability to return multiple values. Haven't been able to get anything to work so far, but here is my best try. Can anybody point out where I'm going wrong?</p>
  
  <pre><code>function foo($array)
  {
      $array[3]=$array[0]+$array[1]+$array[2];
      return $array;
  }
  
  $waffles[0]=1;
  $waffles[1]=2;
  $waffles[2]=3;
  foo($waffles);
  
  echo $waffles[3];
  </code></pre>
  
  <p>For clarification: I want to be able to pass multiple variables into a function, do something, then return multiple variables back out while keeping them seperate. This was just an example I was trying to get working as a work around for not being able to return multiple variables from an array</p>