What is the difference between include(), require(), include_once(), and require_once() in PHP?
include()
and require()
both include and evaluate a specific file. The difference is that require()
will cause a fatal error if the file is not found, while include()
will only produce a warning. Adding _once
ensures that the file is included only once, preventing duplication.