Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.