SimpleXMLElement::__toString

SimpleXMLElement::__toString

(No version information available, might only be in Git)

SimpleXMLElement::__toStringReturns the string content

Description

public string SimpleXMLElement::__toString ( void )

Returns text content that is directly in this element. Does not return text content that is inside this element's children.

Parameters

This function has no parameters.

Return Values

Returns the string content on success or an empty string on failure.

Examples

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

See Also

© 1997–2017 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://secure.php.net/manual/en/simplexmlelement.tostring.php

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部