PHP | XMLReader close() Function Last Updated : 18 Mar, 2020 Comments Improve Suggest changes Like Article Like Report The XMLReader::close() function is an inbuilt function in PHP which is used to close the input of XMLReader object which is currently parsing. Syntax: bool XMLReader::close( void ) Parameters: This function doesn’t accepts any parameters. Return Value: This function returns TRUE on success or FALSE on failure. Below examples illustrate the XMLReader::close() function in PHP: Program 1: data.xml html <?xml version="1.0" encoding="utf-8"?> <root> <p> Hello world </p> </root> index.php php <?php // Create a new XMLReader instance $XMLReader = new XMLReader(); // Open the XML file $XMLReader->open('data.xml'); // Close the XML Reader before reading XML $XMLReader->close(); // Move to the first node $XMLReader->read(); // Read it as a string $string = $XMLReader->readString(); // Output the string to the browser echo $string; ?> Output: // Blank because we closed the input of the XMLReader before reading XML Program 2: data.xml html <?xml version="1.0" encoding="utf-8"?> <body> <h1> GeeksforGeeks </h1> </body> index.php php <?php // Create a new XMLReader instance $XMLReader = new XMLReader(); // Open the XML file $XMLReader->open('data.xml'); // Move to the first node $XMLReader->read(); // Read it as a string $string = $XMLReader->readString(); // Output the string to the browser echo $string; // Close the XML Reader after reading XML $XMLReader->close(); ?> Output: GeeksforGeeks Reference: https://www.php.net/manual/en/xmlreader.close.php Create Quiz Comment G gurrrung Follow 0 Improve G gurrrung Follow 0 Improve Article Tags : Web Technologies PHP PHP-function PHP-XML Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like