Pass variable by reference with func_get_args() in PHP5?
<p>I currently have a class method/function in this form:</p>

<pre><code>function set_option(&amp;$content,$opt ,$key, $val){

   //...Some checking to ensure the necessary keys exist before the assignment goes here.

   $content['options'][$key][$opt] = $val;

}
</code></pre>

<p>Now, I am looking into modification the function a bit to make the first argument optional, allowing me to pass just 3 parameters. In which case, a class property <code>content</code> is used in place of the one I omit.</p>

<p>The first thing that comes to mind is using func_num_args() &amp; func_get_args() in conjunction with this, something like:</p>

<pre><code>function set_option(){

    $args = func_get_args();

    if(func_num_args() == 3){

        $this-&gt;set_option($this-&gt;content,$args[0],$args[1],$args[2]);

    }else{

       //...Some checking to ensure the necessary keys exist before the assignment goes here.

       $args[0]['options'][$args[1]][$args[2]] = $args[3];

   }

}
</code></pre>

<p>How can I specify that I am passing the first argument for this as a reference? (I am using PHP5 so specifying that the variable is passed by reference on function call isn't really one of my better options.)</p>

<p>(I know I can just modify the parameter list so that the last parameter would be optional, doing it like <code>function set_option($opt,$key,$val,&amp;$cont = false)</code>, but I'm curious if passing by reference is possible in conjunction with function definitions like above. If it is I'd rather use it.)</p>
