Jump to content

Help plz:Differences


delickate

Recommended Posts

In basic

include - will include the chosen script, and if not found will produce a non fatal error

include_once - will do the same as include but will only include the file once , therefore if you put include for the file more than once in the code it wont include it more than once.

 

require - like include , but will produce fatal error

require_once - same as include_once , but again fatal error

 

Anyone correct me if im wrong with anything

Link to comment
https://forums.phpfreaks.com/topic/121855-help-plzdifferences/#findComment-628686
Share on other sites

With the include function, if the file cannot be loaded for whatever reason, the page will continue to load as well as the script. The include once will include the file (if it can be found, and only ran once [incase of functions]). Require, is pretty much self explanatory. With the require function, if the file cannot be loaded, the page will cease to write, and you will get an error. Hope this helps.

Link to comment
https://forums.phpfreaks.com/topic/121855-help-plzdifferences/#findComment-628744
Share on other sites

I suggest using require for any authentication scripts or security you want to include. Less important things, use include. That said, I just use require. As, files don't normally vanish so you won't get the error with a live website, plus it's better for testing you're script so you can see if there is an error.

 

If you have any doubts about functions you can try php.net first. It has them all!  :o

Link to comment
https://forums.phpfreaks.com/topic/121855-help-plzdifferences/#findComment-628780
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.