Difference between require and include

Difference between require and include in php:

require(‘filename’) includes the file we specified , while executing, if any error occurred, it produce a fatal error and stop execution of the code.

include(‘filename’) include the file, while executing the same, if any error occurred, produce a warning and execute the reaming code.

require(‘filename’) and require_once(‘filename’)

require_once include the file if it is not included before.
require(‘filename’) include the file in each call.

So include_once will optimize the code.

Posted in Php