array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'simplexmlelement.current.php', 1 => 'SimpleXMLElement::current', 2 => 'Returns the current element', ), 'up' => array ( 0 => 'class.simplexmlelement.php', 1 => 'SimpleXMLElement', ), 'prev' => array ( 0 => 'simplexmlelement.count.php', 1 => 'SimpleXMLElement::count', ), 'next' => array ( 0 => 'simplexmlelement.getdocnamespaces.php', 1 => 'SimpleXMLElement::getDocNamespaces', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/simplexml/simplexmlelement/current.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

SimpleXMLElement::current

(PHP 8)

SimpleXMLElement::currentReturns the current element

Açıklama

public SimpleXMLElement::current(): SimpleXMLElement
Uyarı

Prior to PHP 8.0, SimpleXMLElement::current() was only declared on the subclass SimpleXMLIterator.

This method returns the current element as a SimpleXMLElement object.

Bağımsız Değişkenler

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

Dönen Değerler

Returns the current element as a SimpleXMLElement object.

Hatalar/İstisnalar

Throws an Error on failure.

Sürüm Bilgisi

Sürüm: Açıklama
8.1.0 An Error is now thrown if SimpleXMLElement::current() is called on an invalid iterator. Previously, null was returned.

Örnekler

Örnek 1 Return the current element

<?php
$xmlElement
= new SimpleXMLElement('<books><book>PHP basics</book><book>XML basics</book></books>');

$xmlElement->rewind(); // rewind to first element, otherwise current() won't work
var_dump($xmlElement->current());
?>

Yukarıdaki örneğin çıktısı:

object(SimpleXMLElement)#2 (1) {
  [0]=>
  string(10) "PHP basics"
}

Ayrıca Bakınız