SimpleXMLElement::current
Returns the current element
&reftitle.description;
public SimpleXMLElementSimpleXMLElement::current
Prior to PHP 8.0, SimpleXMLElement::current was only
declared on the subclass SimpleXMLIterator.
This method returns the current element as a SimpleXMLElement object.
&reftitle.parameters;
&no.function.parameters;
&reftitle.returnvalues;
Returns the current element as a SimpleXMLElement object.
&reftitle.errors;
Throws an Error on failure.
&reftitle.changelog;
&Version;
&Description;
8.1.0
An Error is now thrown if
SimpleXMLElement::current is called on an
invalid iterator. Previously, &null; was returned.
&reftitle.examples;
Return the current element
PHP basicsXML basics');
$xmlElement->rewind(); // rewind to first element, otherwise current() won't work
var_dump($xmlElement->current());
?>
]]>
&example.outputs;
string(10) "PHP basics"
}
]]>
&reftitle.seealso;
SimpleXMLElement::key
SimpleXMLElement::next
SimpleXMLElement::rewind
SimpleXMLElement::valid
SimpleXMLElement