Personally, I don't know the format generated directly by ODK Collect: I have access to an ODK Central server, and I retrieve the generated zip files. What the script does is to read the zip files that contain the data, restructure them, and the result can be used to populate a database by simply creating an appropriate class.
The script can be integrated into a PHP application quite simply, the "engine" being encapsulated in separate classes and files (lib folder).
Éric.