title: Should my PHP functions accept an array of arguments or should I explicitly request arguments?
body: <p>In a PHP web application I'm working on, I see functions defined in two possible ways.</p>
  
  <p>Approach 1:</p>
  
  <pre><code>function myfunc($arg1, $arg2, $arg3)
  </code></pre>
  
  <p>Approach 2:</p>
  
  <pre><code>// where $array_params has the structure array('arg1'=&gt;$val1, 'arg2'=&gt;$val2, 'arg3'=&gt;$val3)
  function myfunc($array_params)
  </code></pre>
  
  <p>When should I use one approach over another?  It seems that if system requirements keep changing, and therefore the number of arguments for myfunc keep changing, approach 1 may require a lot of maintenance.</p>