xml_get_current_byte_index

int xml_get_current_byte_index(resource parserID) 

Gets the byte index for the specified parser.

Returns:

Byte index on success; FALSE on error

Description:

Returns the byte index for the parser’s data buffer.

Version:

PHP 3 >= 3.0.6, PHP 4 >= 4.0b1

Example:

Get the XML parser byte index
 // a valid XML document $xmlfile = 'myxmlfile.xml'; $xmlparser = xml_parser_create(); // open a file and read data from it for parsing $fp = fopen($xmlfile, 'r'); while ($xmldata = fread($fp, 4096)) { // parse the data chunk if (xml_parse($xmlparser, $xmldata, feof($fp))) { // print the current byte index of the parser print "The current byte index is: " . xml_get_current_byte_index($xmlparser) . "<BR />"; } else { // if parsing ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.