Array replace PHP in constructor
<p>Here is an example of my class, I have default options defined in the constructor and I want to replace them with any options provided.</p>

<pre><code>class Class{
  private $options;

  function __construct($options=null){
    $this-&gt;options = array('option1'=&gt;'value', 'option2'=&gt;'value', ...);
    array_replace(_recursive)($this-&gt;options,$options);
  }

  function showOpts(){
    print_r($this-&gt;options);
  }
}

$opt = array('newOpt'=&gt;value ..);
$c = new Class($opt);
$c-&gt;showOpts();
</code></pre>

<p>when I print the contents of options I get the default values without any replacement.
What am I doing wrong?</p>
