The behaviors of require
, include
, require_once
, and include_once
in PHP are all very similar with some slight differences. Here is the table highlighting the different behaviors of these statements.
PHP statement | File Does Not Exist | File Already Loaded |
---|---|---|
require |
Fatal Error | loads again |
include |
Warning | loads again |
require_once |
Fatal Error | skips it |
include_once |
Warning | skips it |
Leave a Reply