array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'simplexmlelement.valid.php', 1 => 'SimpleXMLElement::valid', 2 => 'Check whether the current element is valid', ), 'up' => array ( 0 => 'class.simplexmlelement.php', 1 => 'SimpleXMLElement', ), 'prev' => array ( 0 => 'simplexmlelement.tostring.php', 1 => 'SimpleXMLElement::__toString', ), 'next' => array ( 0 => 'simplexmlelement.xpath.php', 1 => 'SimpleXMLElement::xpath', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/simplexml/simplexmlelement/valid.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 8)
SimpleXMLElement::valid — Check whether the current element is valid
Prior to PHP 8.0, SimpleXMLElement::valid() was only declared on the subclass SimpleXMLIterator.
This method checks if the current element is valid after calls to SimpleXMLElement::rewind() or SimpleXMLElement::next().
Bu işlevin bağımsız değişkeni yoktur.
Örnek 1 Check whether the current element is valid
<?php
$xmlElement = new SimpleXMLElement('<books><book>SQL Basics</book></books>');
$xmlElement->rewind(); // rewind to the first element
echo var_dump($xmlElement->valid()); // bool(true)
$xmlElement->next(); // advance to the next element
echo var_dump($xmlElement->valid()); // bool(false) because there is only one element
?>