Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
In PHP one can either use include or require to include files, the difference is that if the file doesn't exist it will emit a fatal error and halt with a require and only emit a warning with inclu...
Question
php
#1: Initial revision
In PHP what is the use case for include instead of require when including PHP scripts?
In PHP one can either use `include` or `require` to include files, the difference is that if the file doesn't exist it will emit a fatal error and halt with a `require` and only emit a warning with `include`. Normally would rather my code fail if code is missing and require that it be fixed rather than just throw a warning which might get ignored. The one solid use case I have seen for `include` was a bitcoin mining hack where a `require` might cause the error to show up in the logs sooner. What is the use case for PHP's `include` vs `require`?