Include and require statements are a way to dynamically include and require files in a PHP script. They can be used to load libraries, frameworks, or other PHP scripts.
The use of this construct has various benefits for programmers and developers. It ensures that all source code is available in one place so that it can be edited easily. It also helps programmers avoid loading unused code unnecessarily.
When an error occurs, the need() method will stop the script from running. There is no fatal error while using the include() function. When the file is not necessary and the application should continue to run even if the file is not discovered, the include() function is commonly used.
The only difference between the two is that if the file is not found, need and its sibling require once throw a fatal error, whereas include and include once just display a warning and continue to load the rest of the page.
Learner's Ratings
4.2
Overall Rating
64%
21%
7%
5%
3%
Reviews
G
Gangasagar Prajapati
5
excellent
R
RAVAN RATHORE
5
Good
K
krishnaraj prabhu
4
excellent
F
Faizal
5
good for all youtuper.
V
VAISHNAVI RAJESH CHALKE
5
good job
J
Javed Khan
5
Lover you method of teahing. Every topic explained on very detail. Thank you
T
Tanuja S
5
Excellent Teaching
S
Shaikh Taukeeruddin
5
Explaining each and every concept very deeply
M
Montu Kumar
4
highly recommended.
P
Prince Gupta
5
Aap log mushkil cheezo ko kitni asaani se samjha dete hain , great
Share a personalized message with your friends.