Best way to process large XML in PHP [duplicate]
This question already has an answer here: Parsing Huge XML Files in PHP 7 answers I have to parse large XML files in php, one of them is 6.5 MB and they could be even bigger. The SimpleXML extension as I've read, loads the entire file into an object, which may not be very efficient. In your experience, what would be the best way? For a large file, you'll want to use a SAX parser rather than a DOM parser. With a DOM parser it will read in the whole file and load it into an object tree in memory. With a SAX parser, it will read the file sequentially and call your user-defined callback functions