Page 1 of 1

XML parsing

Posted: Fri Jan 24, 2003 12:16 pm
by hexahedron
I've been doing some xml parsing, using the example script from php.net:
while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
I noticed that all the fread() functions shown in the examples gave 4096 as the argument for the number of bytes to read. I also noticed that, for the fread function, the examples given suggested:
$contents = fread ($handle, filesize ($filename));
Is there a good reason why I shouldn't use the whole filesize for parsing xml?

--Joel

Posted: Fri Jan 24, 2003 12:22 pm
by volka
they are just examples ;)
But note
The results of this function are cached. See clearstatcache() for more details.
at the manual page of filesize()