PHP | SimpleXMLIterator current() Function Last Updated : 29 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The SimpleXMLIterator::current() function is an inbuilt function in PHP which is used to return the current element as a SimpleXMLIterator object or NULL. Syntax: mixed SimpleXMLIterator::current( void ) Parameters: This function does not accepts any parameters. Return Value: This function returns the current element as a SimpleXMLIterator object on success or NULL on failure. Below programs illustrate the SimpleXMLIterator::current() function in PHP: Program 1: php <?php // Create new SimpleXMLIterator object $xmlIt = new SimpleXMLIterator( '<organization> <name>GeeksforGeeks</name> <address>Noida India</address> <email>[email protected]</email> </organization>' ); // Display the current string var_dump($xmlIt->current()); // Use rewind() function to first element $xmlIt->rewind(); // Display the current string var_dump($xmlIt->current()); ?> Output: NULL object(SimpleXMLIterator)#2 (1) { [0]=> string(13) "GeeksforGeeks" } Program 2: php <?php // Create new SimpleXMLIterator object $xmlIt = new SimpleXMLIterator( '<organization> <name>GeeksforGeeks</name> <address>Noida India</address> <email>[email protected]</email> </organization>' ); // Use rewind() function to first element $xmlIt->rewind(); // Use next() function to get // the next element $xmlIt->next(); // Display the current string var_dump($xmlIt->current()); ?> Output: object(SimpleXMLIterator)#2 (1) { [0]=> string(11) "Noida India" } Reference: https://www.php.net/manual/en/simplexmliterator.current.php Comment More infoAdvertise with us Next Article PHP | SimpleXMLIterator current() Function jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function Php-SimpleXML Similar Reads PHP | SimpleXMLIterator key() Function The SimpleXMLIterator::key() function is an inbuilt function in PHP which is used to return the key of current element. Syntax: mixed SimpleXMLIterator::key( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the XML tag name of the element SimpleXML 1 min read PHP | SimpleXMLIterator next() Function The SimpleXMLIterator::next() function is an inbuilt function in PHP which is used to move the SimpleXMLIterator element to the next element. Syntax: void SimpleXMLIterator::next( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. 1 min read PHP | SimpleXMLIterator valid() Function The SimpleXMLIterator::valid() function is an inbuilt function in PHP which is used to check the current element is valid or not. Syntax: bool SimpleXMLIterator::valid( void ) Parameters: This function does not accept any parameters. Return Value: This function returns TRUE if the current element is 1 min read PHP | SimpleXMLIterator rewind() Function The SimpleXMLIterator::rewind() function is an inbuilt function in PHP which is used to rewind the SimpleXMLIterator to the first element. Syntax: void SimpleXMLIterator::rewind( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. B 1 min read PHP | SplHeap current() Function The SplHeap::current() function is an inbuilt function in PHP which is used to get the current element pointed by the iterator. Generally, the Heap Data Structure are of two types: Max-Heap: In a Max-Heap the key present at the root node must be greatest among the keys present at all of its children 2 min read Like