PHP | XMLReader close() Function
Last Updated :
18 Mar, 2020
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:
Program 2:
- data.xml
<? xml version = "1.0" encoding = "utf-8" ?>
< body >
< h1 > GeeksforGeeks </ h1 >
</ body >
|
- index.php
<?php
$XMLReader = new XMLReader();
$XMLReader ->open( 'data.xml' );
$XMLReader ->read();
$string = $XMLReader ->readString();
echo $string ;
$XMLReader ->close();
?>
|
- Output:
GeeksforGeeks
Reference: https://www.php.net/manual/en/xmlreader.close.php
Share your thoughts in the comments
Please Login to comment...