title: Add variables to an array within a function in PHP
body: <p>So, I am trying to add variables to arrays which are relevant to each other, and since I like to program cleanly I would rather create a function (since I am not aware of any function that can add multiple values to different arrays) that I can pass 4 variables to in a specific order and it adds them to the corresponding arrays. This is better then having to count from the start of the arrays and find out which parts of the array correspond to each other. I tried using this code, but it does not appear to work. Although, if I try adding to the array from outside the function it appears to function properly. Here is my code:</p>
  
  <pre><code>&lt;?php
  function dbg($var1,$var2,$var3,$var4){
    $array1[] = "$var1";
    $array2[] = "$var2";
    $array3[] = "$var3";
    $array4[] = "$var4";
    echo count($array1);
  }
  dbg('foo','bar','ping','pong');
  ?&gt;
  </code></pre>