PHP xml_get_current_byte_index() Function

The xml_get_current_byte_index() function gets the byte index for an XML parser.

This function returns the current byte index on success, or FALSE on failure.

int xml_get_current_byte_index ( resource $parser )

Gets the current byte index of the given XML parser.

Example -

The output of the code above could be:

ERROR: Mismatched tag

Line: 5

Column: 41

Byte Index: 72

ParameterDescription
parserA reference to the XML parser to get byte index from.

This function returns FALSE if parser does not refer to a valid parser, or else it returns which byte index the parser is currently at in its data buffer (starting at 0).