array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'simplexmlelement.tostring.php', 1 => 'SimpleXMLElement::__toString', 2 => 'Returns the string content', ), 'up' => array ( 0 => 'class.simplexmlelement.php', 1 => 'SimpleXMLElement', ), 'prev' => array ( 0 => 'simplexmlelement.savexml.php', 1 => 'SimpleXMLElement::saveXML', ), 'next' => array ( 0 => 'simplexmlelement.valid.php', 1 => 'SimpleXMLElement::valid', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/simplexml/simplexmlelement/toString.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

SimpleXMLElement::__toString

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

SimpleXMLElement::__toStringReturns 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.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

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

Приклади

Приклад #1 Get string content

<?php
$xml
= new SimpleXMLElement('<a>1 <b>2 </b>3</a>');
echo
$xml;
?>

Поданий вище приклад виведе:

1 3

Прогляньте також