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); ?>

SimpleXMLElement::valid

(PHP 8)

SimpleXMLElement::validCheck whether the current element is valid

Açıklama

public SimpleXMLElement::valid(): bool
Uyarı

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().

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

Returns true if the current element is valid, otherwise false

Örnekler

Ö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
?>