dynamic function arguments
<p>I'm passing all my calls to a main mapping function 
and then it should dynamically call other function based on a string (until this part, things are easy)
the problem is that I want to pass arguments to the second function and these parameters may vary.
The following is given (should not be changed):</p>

<pre><code>function test1($x){
     echo $x;
}

function test2($x, $y){
     echo $x * $y;
}
</code></pre>

<p>and now comes the mapping function</p>

<pre><code>function mapping ($str){
      switch ($str){
          case 'name1':
              $fn_name = 'test1';
              $var = 5;
              break;
          case 'name2':
              $fn_name = 'test2';
              $var = 5;
              break;
      }
      $this-&gt;{$fn_name}($var);
}
</code></pre>

<p>And then this will run the mapping:</p>

<pre><code>$this-&gt;mapping('name1');
$this-&gt;mapping('name2');   // This one will crash as it need two variables
</code></pre>

<p>Of course the above is simplified to focus on the problem not the purpose of the code.
The problem is when the function has more than one argument (which can easily happen).
I'm expecting to have the switch case and based on how the case parameters are filled, the line 
<strong><code>$this-&gt;{$fn_name}($var);</code></strong> should work.</p>

<p>Can you please advise or give me ideas, knowing that the functions (test1, test2) structure can NOT be changed. I can NOT suddenly start using <code>func_get_args()</code> or <code>func_get_arg()</code></p>
