IT Community - Software Programming, Web Development and Technical Support

require_once(), require(), include()

This is a discussion on require_once(), require(), include() within the PHP Programming forums, part of the Web Development category; What is difference between require_once(), require(), include()?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 07-16-2007, 06:24 AM
sivakumar sivakumar is offline
D-Web Trainee
 
Join Date: Jul 2007
Posts: 36
sivakumar is on a distinguished road
Question require_once(), require(), include()

What is difference between require_once(), require(), include()?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 07-16-2007, 06:39 AM
Senthilkumar Senthilkumar is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 93
Senthilkumar is on a distinguished road
Default Re: require_once(), require(), include()

Difference between require() and require_once(): require() includes and evaluates a specific file, while require_once() does that only if it has not been included before (on the same page).
So, require_once() is recommended to use when you want to include a file where you have a lot of functions for example. This way you make sure you don't include the file more times and you will not get the "function re-declared" error.

Difference between require() and include() is that require() produces a FATAL ERROR if the file you want to include is not found, while include() only produces a WARNING.

There is also include_once() which is the same as include(), but the difference between them is the same as the difference between require() and require_once().
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
require_once bordeauxkevin PHP Programming 0 12-29-2008 08:51 AM
What is the difference between require, include and include_once? amansundar PHP Programming 3 11-28-2007 08:47 PM
Difference between#include< >and#include" " vigneshgets C and C++ Programming 1 08-01-2007 10:41 PM
What is the difference between require_once(), require(), include()? devarajan.v PHP Programming 2 07-30-2007 04:57 AM
PHP: include &amp; require, what is different? montyauto PHP Programming 2 06-30-2007 12:17 AM


All times are GMT -7. The time now is 06:33 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0