diff between include and require_once()
Moderator: General Moderators
diff between include and require_once()
anyone?? whats the difference between the two.??
- gite_ashish
- Forum Contributor
- Posts: 118
- Joined: Sat Aug 31, 2002 11:38 am
- Location: India
include_once() require_once() -
The diff is between error handling. If include_once() fails it generates Warning i.e program execution will continue, whereas if require_once() fails it generates Fatal error i.e program execution stops.
require_once() says the file is require, without it the program can't go ahead, unlike include_once().
The diff is between error handling. If include_once() fails it generates Warning i.e program execution will continue, whereas if require_once() fails it generates Fatal error i.e program execution stops.
require_once() says the file is require, without it the program can't go ahead, unlike include_once().
Oook... So what is the differance though.. between a; require_once, and a require.
the way I see it is, require_once will only include the document once and never parse it again, where as a require will (like include) be parsed each time teh page is loaded.. and ya the error handeling is differant.
is that correct?
the way I see it is, require_once will only include the document once and never parse it again, where as a require will (like include) be parsed each time teh page is loaded.. and ya the error handeling is differant.
is that correct?
yeshttp://php.net/require_once wrote: The require_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the require() statement, with the only difference being that if the code from a file has already been included, it will not be included again. See the documentation for require() for more information on how this statement works.
Er.. no. volka had it right, but he forgot to correct you on that one. If you require() a file twice in the same page, it will be parsed twice. If you require_once() a page twice, it will be parsed the first time, and ignored the second time.the way I see it is, require_once will only include the document once and never parse it again, where as a require will (like include) be parsed each time teh page is loaded.. and ya the error handeling is differant.
is that correct?