PHP | DOMProcessingInstruction __construct() Function Last Updated : 12 Dec, 2021 Comments Improve Suggest changes Like Article Like Report The DOMProcessingInstruction::__construct() function is an inbuilt function in PHP which is used a new read-only DOMProcessingInstruction object. To create a writable node, use DOMDocument::createProcessingInstruction.Syntax: public DOMProcessingInstruction::__construct( string $name, string $value ) Parameters: This function accept two parameters as mentioned above and described below: $name: It specifies the tag name of the processing instruction.$value: It specifies the value of the processing instruction. Below given programs illustrate the DOMProcessingInstruction::__construct() function in PHP:Program 1: Press Ctrl+U to see the DOM php <?php // Create a new DOMDocument instance $dom = new DOMDocument(); // Create a html element $html = $dom->appendChild(new DOMElement('html')); // Create a body element $body = $html->appendChild(new DOMElement('body')); // Create a new DOMProcessingInstruction node $pinode = new DOMProcessingInstruction('php', 'echo "GeeksforGeeks"; '); // Append the child $body->appendChild($pinode); // Render the XML echo $dom->saveXML(); ?> Output: Program 2: Press Ctrl+U to see the DOM element. php <?php // Create a new DOMDocument instance $dom = new DOMDocument(); // Create a html element $html = $dom->appendChild(new DOMElement('html')); // Create a body element $body = $html->appendChild(new DOMElement('body')); // Create a new DOMProcessingInstruction node $pinode = new DOMProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="base.xsl"'); // Append the child $body->appendChild($pinode); // Render the XML echo $dom->saveXML(); ?> Output: Reference: https://www.php.net/manual/en/domprocessinginstruction.construct.php Comment More infoAdvertise with us Next Article PHP | DOMProcessingInstruction __construct() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-DOM Similar Reads 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 | 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 | 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 DOMDocument createProcessingInstruction() Function The DOMDocument::createProcessingInstruction() function is an inbuilt function in PHP that is used to create a new instance of the class DOMProcessingInstruction. Syntax: DOMProcessingInstruction DOMDocument::createProcessingInstruction( $target, $data ) Parameters: This function accepts two paramet 1 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 Like