Open In App

PHP | XMLReader moveToFirstAttribute() Function

The XMLReader::moveToFirstAttribute() function is an inbuilt function in PHP which is used to position cursor on the first attribute of the element. This function is useful when we have multiple attributes for an element and we want to get the first one or when we want to check if an element has any attributes or not.

Syntax:



bool XMLReader::moveToFirstAttribute( void )

Parameters: This function doesn’t accept any parameter.

Return Value: This function returns TRUE on success or FALSE on failure.



Below examples illustrate the XMLReader::moveToFirstAttribute() function in PHP:

Example 1:

Program 2:

Reference: https://www.php.net/manual/en/xmlreader.movetofirstattribute.php


Article Tags :