title: Using an associative array as php function's input
body: <p>Occasionally I'll write a PHP function with a single input, an associative array containing all of that function's inputs. This has benefits such as not having to remember the correct order of inputs, but I've also noticed it makes implementing changes to large codebases much easier; when I need to add another variable, and that variable has to pass through 4 or 5 pre-existing functions, it's much easier when I can just stick it in the array and pass it along.</p>
  
  <p>My question is, is there a downside to doing this?</p>
  
  <p>I rarely see functions written this way in examples, or in open source I use, which leads me to believe there is probably a downside. If there <em>isn't</em> a reason not to do it then why not write all functions this way?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks for all your answers. It looks like two major problems stand out:</p>
  
  <p><strong>Code readability</strong> - impossible to tell what variables are going into a function and what they're for</p>
  
  <p><strong>Variable creep</strong> - Could wind up with massive arrays bouncing from one function to the next; one should not pass parameters to functions that don't require them</p>
  
  <p>Which are both great points I did not think about.</p>
  
  <p>It seems the general gist as well is that code where this is an issue, should probably be converted to a class. Unfortunately in this specific project such a refactoring is beyond the scope, but I also think Bill Karwin's solution is good - pass an array of optional variables</p>