php ? include require

dharmil

New Member
Messages
1,656
Reaction score
0
Points
0
PHP:
<?php include(); ?>
PHP:
<?php require(); ?>

whats the diffrence
 

Rising

New Member
Messages
792
Reaction score
0
Points
0
One is probably going to get cut out in a future version of PHP, like some of the older functions that have newer codes, i might be wrong, (someone who actually knows PHP say something) im just using an educated guess, because my friend says they do this kind of stuff all the time
 

dharmil

New Member
Messages
1,656
Reaction score
0
Points
0
if its the same thing they might do that but i am not sure if its the same so i am asking
 

dsfreak

New Member
Messages
1,338
Reaction score
0
Points
0
Well, I would look here, as it looks to tell you what they do, basically. http://builder.com.com/5100-31-5077715.html
^^ Yes, .com.com IS CORRECT, NOT A TYPO

But, I think require happens to require the page's content in the page the "require" tag is in, while include seems to be used more to check authentication, like, (not really code), "if login=true then include ('file.php')", while require would be like, "Copyright require ('ipblicensecheck.ipb.com/8989990980.php')" to require that file to validate, otherwise, the page will not load.


Anyone, correct me if I am wrong... Thanks!
 

dharmil

New Member
Messages
1,656
Reaction score
0
Points
0
no it wil still be there because there are is other things you can do with it like creat a navagation thing with it
 

dharmil

New Member
Messages
1,656
Reaction score
0
Points
0
my site
forums
news
shout
all the pages
navagation


every thing requires includes functuion
 

ak007

Member
Messages
216
Reaction score
0
Points
16
You Are Wrong!
Actually if You Include A File Using "Include()" and If PHP Fails To Include That File PHP Will Give You Warnings But Will Cotinue processing Script But On The Other Hand If You Include The File Using "require()" And PHP Fails To include It PHP Will OutPut Warnings + Terminate The Script
 
Last edited:

dharmil

New Member
Messages
1,656
Reaction score
0
Points
0
ak007 said:
You Are Wrong!
Actually if You Include A File Using "Include()" and If PHP Fails To Include That File PHP Will Give You Warnings But Will Cotinue processing Script But On The Other Hand If You Include The File Using "require()" And PHP Fails To include It PHP Will OutPut Warnings + Terminate The Script

thanks for the update
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Yea I was wondering if you (Ak007) were going to post. ;-)

What he said is exactly true. When you use the include() construct, if the "file to be included" does not exist or cannot be included, you will just emit E_WARNING level error, which will not "stop" your script from running.

With the require() construct, if the file can not be "included" into the script, the parser will generate an error level of E_ERROR, which is a fatal error and will halt the script immediatly.

Another thing you might know about, or might not, whatever, (I just skimmed over the thread.), is the include_once() and require_once() constructs. Each one is just about teh same as just require() and include(), except they will make sure a script is only included ONCE, and nothing more.

Ahh, I think I got that all right. I hope. :-/
 

anthony-mcgowan52

New Member
Messages
4
Reaction score
0
Points
0
The main difference is that require(); will produce a fatal error if an error occurs and halt the script so there is no further output, whereas include(); will produce a warning and then carry on with the rest of the script.

You would therefore use require(); (or require_once) if you want to make certain there is no messy output should an error occur, and include(); if perhaps that is not such an issue with this.
 
Top