Difference between "include" and "require" in php

Viewed 122480

Is there any difference between them? Is using them a matter of preference? Does using one over the other produce any advantages? Which is better for security?

7 Answers

The difference between include() and require() arises when the file being included cannot be found: include() will release a warning (E_WARNING) and the script will continue, whereas require() will release a fatal error (E_COMPILE_ERROR) and terminate the script. If the file being included is critical to the rest of the script running correctly then you need to use require().

For more details : Difference between Include and Require in PHP

Related