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?
Advertisement
Answer
You find the differences explained in the detailed PHP manual on the page of require:
requireis identical toincludeexcept upon failure it will also produce a fatalE_COMPILE_ERRORlevel error. In other words, it will halt the script whereas include only emits a warning (E_WARNING) which allows the script to continue.
See @efritz’s answer for an example