What is the point of attempting to include or include_once a library in PHP if you often have to use require or require_once instead (as they’re usually critically important)?
What is the point of attempting to include or include_once a library in PHP
Share
The difference between
include/include_onceandrequire/require_onceis that when a file is not found, the former triggers a warning whereas the latter triggers an error. Opinions may vary but IMO, if a needed file is not present or readable for some reason, this represents a very broken situation and I would rather see an error and halt execution, than have a warning and proceed execution in a clearly broken context. So I believe it to be best practice to userequire/require_onceexclusively and avoidinclude/include_oncealtogether.