(PHP 5 >= 5.3.0, PHP 7)
SimpleXMLElement::__toString — Returns the string content
public SimpleXMLElement::__toString ( ) : string
Returns text content that is directly in this element. Does not return text content that is inside this element's children.
This function has no parameters.
Returns the string content on success or an empty string on failure.
Example #1 Get string content
<?php $xml = new SimpleXMLElement('<a>1 <b>2 </b>3</a>'); echo $xml; ?>
The above example will output:
1 3
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/simplexmlelement.tostring.php