when use require ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

when use require ??

4th Jul 2016, 11:14 AM
Monika Darji
Monika Darji - avatar
7 Answers
+ 3
you use require when a program cannot work unless a particular resource is available
4th Jul 2016, 3:25 PM
Midhun Mathew
+ 1
In another words the difference between include and require is that: if include statement fails script continues, but if require fails than script stops.
5th Jul 2016, 10:19 AM
Komron Miralizoda
+ 1
You should use 'require' when the file is very important in order to run your php script. For example the file that contains functions for form validation is required otherwise you website will be the victim of SQL injection.
26th Dec 2016, 12:16 PM
Raniket Ram
Raniket Ram - avatar
+ 1
require statements allow for the insertion of the content of one PHP file into another PHP file, before the server executes it.
28th Feb 2017, 5:49 PM
Black Shadow
Black Shadow - avatar
0
More like "require" is a must if you want the info to be displayed, whereas "include" behave like you ll get a container or box however, question is whether you want the box with object inside it or just the empty box.
5th Jul 2016, 11:02 AM
Avijit Bhattacharjee
Avijit Bhattacharjee - avatar
0
we use require if we want to use a already created php file in our program. unlike include it will throw an error if the file is missing.
17th Aug 2016, 1:07 PM
Atul Sethia
Atul Sethia - avatar
0
it gives fatal error and stops the execution
8th Dec 2016, 7:34 AM
Vidadala Deepu
Vidadala Deepu - avatar