I’m importing data into a php array from an xml file using SimpleXML.
I’m using the simplexml_load_file function, but once i’ve got the data I need, do I need to close the file or similar to clear the memory?
Thanks,
James
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No you don’t need to do anything with the file.
simplexml_load_file()will close the file internally after it has read the content.If you take a look at the source code for
simplexml_load_file, you’ll see that it is calling theCfunctionxmlReadFile()form xmllib2, which in turn will close the file after reading.