Current Location: Home> Function Categories> __toString

__toString

Returns the string content of the element.
Name:__toString
Category:Uncategorized
Programming Language:php
One-line Description:Returns the string content of the element.

Definition and usage

__toString() function returns the string content of the element.

This function returns the direct string content in the element, not the string content in the child element of the element!

Example

Returns the string content of the <note> element:

 <?php
$xml = new SimpleXMLElement ( "<note>Hello <to>George</to><from>John</from>World!</note>" ) ;
echo $xml ;
?>

Run the instance

grammar

 SimpleXMLElement :: __toString ( )
Similar Functions
Popular Articles