title: array_push not working within function, PHP
body: <p>I have this case when I have array_push inside function and then I need to run it inside foreach filling the new array. Unfortunately I can't see why this does not work. Here is the code:</p>
  
  <pre><code>&lt;?php
  
  $mylist = array('house', 'apple', 'key', 'car');
  $mailarray = array();
  
  foreach ($mylist as $key) {
      online($key, $mailarray);
  }
  
  function online($thekey, $mailarray) {
  
      array_push($mailarray,$thekey);
  
  }
  
  print_r($mailarray);
  
  ?&gt;
  </code></pre>
  
  <p>This is a sample function, it has more functionality and that´s why I need to maintain the idea.</p>
  
  <p>Thank you.</p>