PHP | DOMEntityReference __construct() function Last Updated : 19 Feb, 2020 Comments Improve Suggest changes Like Article Like Report The DOMEntityReference::__construct() function is an inbuilt function in PHP which is used to create a new DOMEntityReference object. Syntax: public DOMEntityReference::__construct( string $name ) Parameters:This function accepts a single parameter $name which holds the name of the entity reference. Below given programs illustrate the DOMEntityReference::__construct() function in PHP: Program 1: php <?php // Create a new DOMDocument $dom = new DOMDocument(); // Add the node to the dom $element = $dom->appendChild(new DOMElement('H1')); // Add the DOM Entity Reference as a child $entity = $element->appendChild(new DOMEntityReference('GeeksforGeeks')); // Render the XML echo $dom->saveXML(); ?> Output: Program 2: php <?php // Create a new DOMDocument $dom = new DOMDocument(); // Add the node to the dom $element = $dom->appendChild(new DOMElement('body')); // Add the DOM Entity Reference as a child $entity = $element->appendChild(new DOMEntityReference('GeeksforGeeks')); // View the name of node echo $entity->nodeName; ?> Output: GeeksforGeeks Reference: https://www.php.net/manual/en/domentityreference.construct.php Comment More infoAdvertise with us Next Article PHP | DOMEntityReference __construct() function G gurrrung Follow Improve Article Tags : Web Technologies PHP Similar Reads PHP | DOMAttr __construct() Function The DOMAttr::__construct() function is an inbuilt function in PHP which is used to create a new DOMAttr object. This created object is a read-only type. Syntax: public DOMAttr::__construct( string $name, string $value ) Parameters: This function accepts two parameters as mentioned above and describe 2 min read PHP | DOMElement __construct() Function The DOMElement::__construct() function is an inbuilt function in PHP which is used to create a new DOMElement object. This object is read-only and may be appended to a document, but additional nodes may not be appended to this node until the node is associated with a document. Syntax: public DOMElem 2 min read PHP | DOMImplementation __construct() Function The DOMImplementation::__construct() function is an inbuilt function in PHP which is used to create a new DOMImplementation object. Syntax: DOMImplementation::__construct( void ) Parameters: This function doesnât accept any parameter. Below examples illustrate the DOMImplementation::__construct() fu 1 min read PHP | DOMDocument __construct() Function The DOMDocument::__construct() function is an inbuilt function in PHP which is used to create a new DOMDocument object. Syntax: public DOMDocument::__construct( string $version, string $encoding ) Parameters: This function accepts two parameters as mentioned above and described below: $version: This 1 min read PHP | DsPair __construct() Function The Ds\Pair::__construct() function is an inbuilt function in PHP which is used to create a new instance. Syntax: public Ds\Pair::__construct( $key, $value ) Parameters: This function accepts two parameters as mentioned above and described below: $key: This parameter holds the key of the pair elemen 2 min read Like