PHP | DOMImplementation __construct() Function Last Updated : 26 Feb, 2020 Comments Improve Suggest changes Like Article Like Report 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() function in PHP: Example 1: php <?php // Create a DOMImplementation instance $documentImplementation = new DOMImplementation(); // Create a document $document = $documentImplementation->createDocument(null, 'html'); // Get the document element $html = $document->documentElement; // Create few element $heading = $document->createElement('h1'); $text = $document->createTextNode('GeeksforGeeks'); // Append the children $heading->appendChild($text); $html->appendChild($heading); // Render the XML echo $document->saveXML(); ?> Output: Example 2: php <?php // Create a DOMImplementation instance $documentImplementation = new DOMImplementation(); // Create a document $document = $documentImplementation->createDocument(null, 'html'); // Get the document element $html = $document->documentElement; // Create few element $head = $document->createElement('head'); $title = $document->createElement('title'); $text = $document->createTextNode('GeeksforGeeks'); $body = $document->createElement('body'); // Append the children $title->appendChild($text); $head->appendChild($title); $html->appendChild($head); $html->appendChild($body); // Render the XML echo $document->saveXML(); ?> Output: Reference: https://www.php.net/manual/en/domimplementation.construct.php Comment More infoAdvertise with us Next Article PHP | DOMImplementation __construct() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-DOM Similar Reads 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 | DOMComment __construct() Function The DOMComment::__construct() function is an inbuilt function in PHP which creates a new DOMComment object. This object is read only and can be appended to a document Syntax: public DOMComment::__construct( string $value) Parameters: This function accepts a single parameter $value which holds the co 1 min read PHP | DOMImplementation createDocument() Function The DOMImplementation::createDocument() function is an inbuilt function in PHP which is used to create a DOMDocument object of the specified type with its document element. Syntax: DOMDocument DOMImplementation::createDocument( string $namespaceURI = NULL, string $qualifiedName = NULL, DOMDocumentTy 2 min read PHP | DOMCdataSection __construct() Function The DOMCdataSection::__construct() function is an inbuilt function in PHP which is used to construct a new DOMCdataSection object. DOMC stands for DOM Character and this section can further be manipulated using the methods of DOMCharacterData class. This CDATA node works like the DOMTEXT class. Synt 1 min read PHP | DOMImplementation createDocumentType() function The DOMImplementation::createDocumentType() function is an inbuilt function in PHP which is used to create an empty DOMDocumentType object. Entity declarations and notations are not available. Syntax: DOMDocumentType DOMImplementation::createDocumentType ( string $qualifiedName = NULL, string $publi 1 min read Like