+ 7

What is common difference between include, require and require once?

difference - include and require

19th Mar 2017, 9:48 PM
CODE SAILOR
CODE SAILOR - avatar
1 Answer
+ 5
include = If fail to import the script throw an error but continue running. require= If fail to import the script throw an error and block the remaining part of the script. Add "_once" is to make sure that the script is only import once, if for some reason you need to import X time the same script you use require or include but if you want to make sure that your code will only keep 1 import running you add the suffix.
19th Mar 2017, 10:08 PM
Geoffrey L
Geoffrey L - avatar