Interviews - C# Corner

Kishan Kumar
What is the difference between include(), include_once() and require_once()
By Kishan Kumar in PHP onFeb 19 2018
  • Kishan Kumar
    Feb, 2018 19

    The include() statement includes and evaluates a specified line i.e. it will include a file based in the given path. require() does the same thing expect upon failure it will generate a fatal error and halt the script whereas include() will just gives a warning and allow script to continue. require_once() will check if the file already has been included and if so it will not include the file again.

    • 1
  • Velu D
    Jul, 2019 4

    Include Once The include_once() statement includes and evaluates the specified file during the execution of the script. ... This is a behavior similar to the require() statement, with the only difference being that if the code from a file has already been included, it will not be included again.

    • 0
  • Abhijit Sahoo
    Jul, 2018 4

    The only difference between the two is that require and its sister require_once throw a fatal error if the file is not found, whereas include and include_once only show a warning and continue to load the rest of the page.

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS