1.

Which one of the following statements is true for include_once() and require_once()?(a) Both are exactly the same(b) include_once is used for files where as require_once() is not(c) Both Handle the errors in the same way(d) Both do not handle the errors in the same wayThis question was posed to me in an interview for job.I'd like to ask this question from Object Tools-1 topic in section Object Tools and Design and Variables in PHP of PHP

Answer»

Right choice is (d) Both do not handle the errors in the same way

For EXPLANATION I WOULD say: The only difference between the INCLUDE() and require() statements lies in their handling of errors. A file invoked using require() will bring down your entire process when you MEET an error. The same error ENCOUNTERED via a call to include() will merely generate a warning and end execution of the included file.



Discussion

No Comment Found

Related InterviewSolutions