title: Pass Associative Array to Function in PHP
body: <p>I'm curious to know if there is some way to call a function using an associative array to declare the parameters.</p>
  
  <p>For instance if I have this function:</p>
  
  <pre><code>function test($hello, $world) {
      echo $hello . $world;
  }
  </code></pre>
  
  <p>Is there some way to call it doing something like this?</p>
  
  <pre><code>call('test', array('hello' =&gt; 'First value', 'world' =&gt; 'Second value'));
  </code></pre>
  
  <p>I'm familiar with using <code>call_user_func</code> and <code>call_user_func_array</code>, but I'm looking for something more generic that I can use to call various methods when I don't know what parameters they are looking for ahead of time.</p>
  
  <p>Edit:
  The reason for this is to make a single interface for an API front end. I'm accepting JSON and converting that into an array. So, I'd like different methods to be called and pass the values from the JSON input into the methods.
  Since I want to be able to call an assortment of different methods from this interface, I want a way to pass parameters to the functions without knowing what order they need to be in.  I'm thinking using reflections will get me the results I'm looking for.</p>