PHP | XMLWriter fullEndElement() Function
Last Updated :
07 Mar, 2024
The XMLWriter::fullEndElement() function is an inbuilt function in PHP which is used to end current element which is started using XMLWriter::startElement() function. Difference between endElement() function and fullEndElement() function is that the former adds a backslash to same element in case of empty element whereas later creates a separate ending element.
Syntax:
bool XMLWriter::fullEndElement( void )
Parameters: This function doesn’t accept any parameter.
Return Value: This function returns TRUE on success or FALSE on failure.
Below examples illustrate the XMLWriter::fullEndElement() function in PHP:
Example 1:
<?php
$writer = new XMLWriter();
$writer ->startDocument( '1.0' , 'UTF-8' );
$writer ->startElement( 'p' );
$writer ->fullEndElement();
$writer ->endDocument();
?>
|
Output:
Example 2: In this program, we will compare endElement() and fullEndElement() functions
<?php
$writer = new XMLWriter();
$writer ->startDocument( '1.0' , 'UTF-8' );
$writer ->setIndent(true);
$writer ->startElement( 'fullEndElement' );
$writer ->fullEndElement();
$writer ->startElement( 'endElement' );
$writer ->endElement();
$writer ->endDocument();
?>
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...