I’m using domdocument load to fetch some data. On occasion, this data is not available and when the script runs, I will get errors or warnings. I noticed that I can test for a return value if the data is not there. Is it best to use a while loop or an if statement?
Share
I’m assuming you are trying to load a remote document, and that’s why it is occasionally unavailable.
I suggest trying the following:
This could also be written as a for loop of course. It doesn’t really matter.