First of all we should know what is the difference and similarity between include() and require(), include() and require() are used to include other files into a PHP file, and the difference between them are the include() generates a warning when there is an error, but the script will continue execution, otherwise, the require() generates a fatal error, and the script will stop.
The require_once() statement is similar to require() except require_once() will check if the file has already been included, and if so, it will not require it again, same with include_once().
Top comments (15)
It's worth mentioning that the error you are talking about is that the file that we try to import is not found.
include()
can cause crash too for other reasons (the included php script contains functions already declared at the last inclusion for ex -> for this reason we use *_once() options).oh thank you for your feedback I really appreciate it, I will edit this post and add more examples and explanation!
Thank you!
But thanks for this little explanation !
Thank you that's amazing
Thank you!
Thanks, very short nice and to the point.
Thank you!
Your introduction was short and clear.
Thanks.
Thank you!
Nice, thanks keep writing
Thank you, I'll keep writing!
good
Thanks!
This is really helpful, thank you!
Thank you!