Sr. PHP Programmer Question:

Download Job Interview Questions and Answers PDF

require_once(), require(), include(). What is difference between them?

Senior PHP Programmer Interview Question
Senior PHP Programmer Interview Question

Answer:

require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page). So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don't include the file more times and you will not get the "function re-declared" error.

Download Senior PHP Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
What is the purpose of _FILE_ constant?Tell me how to set cookies in PHP?