Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
The developers use these functions , and I always see them in code , but what is the main differences between them.
Which could represent the needed and added in turn means what is needed( a must ) to do the job and what should be added as for back up.
just go to dictionary, don't waste time
The include function is used in PHP when you want to include a file within the current process.This can be used in a php templating system where you have a header at the top of the page and the header is going to be the same on all pages. You will put this code inside it's own file and use the include function to add the file to the page.
If the file that you want to include is not found then this function to return a PHP warning but will continue with the application.
The include_once function is exactly the same as the include function except it will limit the file to be used once.
A practical use of this function is if you define any functions in the included file to avoid redefinition of a function you should include it with a include_once.
The require function acts just like the include function except if the file can not be found it will throw a PHP Fatal error E_COMPILE_ERROR which will stop the application continuing,. As the name suggests this file is required for the application to work correctly.
You can read here in depth.
Cheers!