IT Community - Software Programming, Web Development and Technical Support

PHP: include & require, what is different?

This is a discussion on PHP: include & require, what is different? within the PHP Programming forums, part of the Web Development category; Hope this is not stupid question. I read the manual frequently, still could not understand what different between include() and ...


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

Register FAQ Members List Calendar Mark Forums Read
  2 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 06-07-2007, 02:11 AM
montyauto montyauto is offline
D-Web Programmer
 
Join Date: Feb 2007
Posts: 55
montyauto is on a distinguished road
Thumbs up PHP: include & require, what is different?

Hope this is not stupid question.

I read the manual frequently, still could not understand what different between include() and require(), it makes no different to me.

Could you show me in an example script to show the different result between those two? Thanks.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-07-2007, 04:22 AM
montyauto montyauto is offline
D-Web Programmer
 
Join Date: Feb 2007
Posts: 55
montyauto is on a distinguished road
Thumbs up PHP: include & require, what is different?

Hope this is not stupid question.

I read the manual frequently, still could not understand what different between include() and require(), it makes no different to me.

Could you show me in an example script to show the different result between those two? Thanks.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-30-2007, 01:17 AM
vadivelanvaidyanathan vadivelanvaidyanathan is offline
D-Web Genius
 
Join Date: Feb 2007
Posts: 803
vadivelanvaidyanathan is on a distinguished road
Default Re: PHP: include & require, what is different?

Unlike include(), require() will always read in the target file, even if the line it's on never executes. If you want to conditionally include a file, use include(). The conditional statement won't affect the require(). However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed.
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 On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/php-programming/1477-php-include-require-what-different.html
Posted By For Type Date
PHP: include & require, what is different? - geek/talk This thread Refback 08-08-2007 03:02 PM
PHP: include & require, what is different? - geek/talk This thread Refback 08-05-2007 05:19 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the difference between require, include and include_once? amansundar PHP Programming 3 11-28-2007 09:47 PM
Difference between#include< >and#include" " vigneshgets C and C++ Programming 1 08-01-2007 11:41 PM
Explain the difference between use and require. vadivelanvaidyanathan Perl 1 07-30-2007 07:39 AM
What is the difference between require_once(), require(), include()? devarajan.v PHP Programming 2 07-30-2007 05:57 AM
require_once(), require(), include() sivakumar PHP Programming 1 07-16-2007 07:39 AM


All times are GMT -7. The time now is 05:20 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0