The
XMLWriter::openUri() function is an inbuilt function in PHP which is used to create a new XMLWriter using source URI for output. In simple words, this function decides how to output the XML to user, it can be through a browser or directly to a file.
Syntax:
bool XMLWriter::openUri( string $uri )
Parameters:This function accepts a single parameter
$uri which holds the uri for output.
Return Value: This function returns TRUE on success or FALSE on failure.
Below examples illustrate the
XMLWriter::openUri() function in PHP:
Example 1:
Output:
GeeksforGeeks
Example 2:
Output: This will create a new file called
new.xml in the same folder with the following content
👁 Image