What is the difference between the include() and require() functions?

0

include() function

This function is used to copy all the contents of a file called within the function, text wise into a file from which it is called.

When the file is included and cannot be found, it will only produce a warning (E_WARNING) and the script will continue the execution.

require() function:

The require() function performs the same as the include() function. It also takes the file that is required and copies the whole code into the file from where the require() function is called.

When the file is included and cannot be found, it will produce a fatal error (E_COMPILE_ERROR) and terminates the script.

Php
asked May 17, 2023 at 17:22
Sign in to add a comment

0 Answers

0
📝 No answers yet!

Be the first to answer this interview question.

Your Answer

Sign in to post your answer and help the community.