how does self in a child class exactly work in php
<p>I am trying to generate an xml file using the below class, when an array data is passed with no depth constraints the xml gets generated by the below code successfully. I am just trying to figure out as how  <code>self::createNode($value, $child);</code> statements works does it create a new object? what is the significance of the the <code>parent::_construct</code> statement in the class constructor ? as the encoding is initialized already in the child class constructor.
What I have read since now about the self keyword is that it is used to call the static methods, but here the createNode method is non static. Will someone be able to help me out in understanding the context of this statement, what I can say here is the the DomDocument class doesn't have any createNode method at all. Will anyone be able to help? 
Thank you very much.</p>

<pre><code>class array2xml extends DomDocument
{
    public $nodeName;
    private $xpath;
    private $root;
    private $node_name;
    public $xml_data;

    public function __construct($root='root', $node_name='node')
    {
        parent::__construct();
        $this-&gt;encoding = "UTF-8";
        $this-&gt;formatOutput = true;
        $this-&gt;node_name = $node_name;
        $this-&gt;root = $this-&gt;appendChild($this-&gt;createElement($root));
        $this-&gt;xpath = new DomXPath($this);
    } 

    public function createNode( $arr, $node = null)
    {   
        if (is_null($node))
        {
            $node = $this-&gt;root;
        }
        foreach($arr as $element =&gt; $value) 
        {
            $element = is_numeric( $element ) 
                ? $this-&gt;node_name 
                : $element;
            $element = htmlspecialchars($element,ENT_QUOTES,'UTF-8');
            $child = $this-&gt;createElement($element, (is_array($value) 
                ? null 
                : htmlspecialchars($value,ENT_QUOTES,'UTF-8')));
            $node-&gt;appendChild($child);
            if (is_array($value))
            {
                self::createNode($value, $child);
            }
        }
    }

    public function __toString()
    {
        $this-&gt;xml_data= $this-&gt;saveXML();
        return $this-&gt;saveXML();
    }
}
</code></pre>
