what is the difference between foo(array(...)) and foo($x=array(...))?
<p>See this example:</p>

<p>This class extends DOMElement. Every DOMElement must be a part of
any DOMDocuement to be modifable.</p>

<pre><code>class Xmlrize  extends DOMElement
{
    private static $dom;

    public function __construct(/*. string .*/ $name,$value =null) {
        parent::__construct($name,$value,null);
    if(!self::$dom) {
            self::$dom = new DOMDocument('1.0','UTF-8');
        }
        self::$dom-&gt;appendChild($this);
    }
}
</code></pre>

<p>Used to add array into DOM. If value of the array is  not Xmlrize, then I ignore it.</p>

<pre><code>class Attributes extends Xmlrize {

    public function __construct(array $attributes)
    {
        parent::__construct('Attributes');

        foreach($attributes as $name =&gt; $value) {
            $element = new Xmlrize($name);
            if($value instanceof Xmlrize)
                $element-&gt;appendChild($value);
            $this-&gt;appendChild($element);
        }
    }
}
</code></pre>

<p>You can add instance of Attributes in the constructor</p>

<pre><code>class Html extends Xmlrize {

    public function __construct(Attributes $obj) {
        parent::__construct('html');
        $this-&gt;addAttributes($obj);
    }
</code></pre>

<p>This method shows if attribute is or is not instance of Xmlrize.</p>

<pre><code>    protected function addAttributes(Attributes $attributes)
    {
        foreach($attributes-&gt;childNodes as $attribut) {
           if($attribut-&gt;childNodes-&gt;length == 1) {
                $item = $attribut-&gt;childNodes-&gt;item(0);
            echo $attribut-&gt;nodeName.': ';
            echo $item-&gt;nodeName.' has value '.$item-&gt;nodeValue.'. ';
            echo 'Is it DomElement? ';
            echo ($item instanceof DomElement) ? 'true' : 'false';
            echo '. Is it Xmlrize? ';
            echo ($item instanceof Xmlrize) ? 'true' : 'false';
            echo '.'.PHP_EOL;
           }
        }
        return null;
    }
}
</code></pre>

<p>Example of initiating of Attributes by array. See the differences!</p>

<pre><code>/* works as expected */
$like = new Html(new Attributes(
            $xx =  array('XXX'=&gt; new Xmlrize('foo', 'baar'))
));

/* do not work as exptected */
$like = new Html(new Attributes(
              array('XXX'=&gt; new Xmlrize('foo', 'baar'))
));
?&gt;
</code></pre>

<p>The example above returns:</p>

<pre><code>XXX: foo has value baar. Is it DomElement? true. Is it Xmlrize? true.
XXX: foo has value baar. Is it DomElement? true. Is it Xmlrize? false.
</code></pre>

<p>Why if I add '$xx =' the element is considered as Xmlrize and if not, it isn't?</p>
