Open In App

PHP | XMLReader open() Function

The XMLReader::open() function is an inbuilt function in PHP which is used to set the URI containing the XML document to be parsed. In simple words, this function is used to open the XML file which needs to be worked upon.

Syntax:



bool XMLReader::open( string $URI, string $encoding, int $options )

Parameters: This function accept three parameters as mentioned above and described below:

Return Value: This function returns TRUE on success or FALSE on failure.



Exceptions: This function throws an E_STRICT error, if called statically.

Below examples illustrate the XMLReader::open() function in PHP:

Example 1:

Program 2:

Reference: https://www.php.net/manual/en/xmlreader.open.php


Article Tags :