Syntax:public DOMDocument::__ construct (string $version, string $encoding)
Parameters:This function takes two parameters as above and described below: - $version: this parameter contains the document version as part of the XML declaration.
- $encoding:this parameter contains the document encoding as part of the XML declaration.
The following programs illustrate the DOMDocument::__ construct() function in PHP:Program 1:
// Create a new DOMDocument
$dom
=
new
DOMDocument (
’1.0’
,
’ iso-8859-1’
);
// Show output
echo
$dom
-> saveXML();
?>
Exit: Program 2:
// Create a new DOMDocument
$dom
=
new
DOMDocument (
’ 1.0’
,
’iso-8859-1’
);
// Set the xmlStandalone() function to True
$dom
-> xmlStandalone =
"true"
;
// Show output
echo
$dom
-> saveXML();
?>
Exit: Link: https://www.php.net/ manual / en / domdocument.construct.php