Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1246 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

PHP: include & require, what is different?

Thread title: PHP: include & require, what is different?
Closed Thread    
    Thread tools Search this thread Display Modes  
08-15-2007, 10:54 AM
#1
montyauto is offline montyauto
montyauto's Avatar
Status: Junior Member
Join date: Apr 2006
Location:
Expertise:
Software:
 
Posts: 68
iTrader: 0 / 0%
 

montyauto is on a distinguished road

  Old  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.

08-15-2007, 10:59 AM
#2
Immersion is offline Immersion
Status: Senior Member
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 918
iTrader: 5 / 100%
 

Immersion is on a distinguished road

  Old

Well its pretty simple really and fairly self explanatory in the function names.

Both are including another file. Include() will try to get the file but if the file is not there or for some reason cant be included the rest of the script will continue.

Where as with require() if trys to include the file and if it cant the rest of the script will not be processed.

Both methods will return an error if the file cannot be included.

08-15-2007, 03:21 PM
#3
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

It's in what type of error it raises, include throws E_WARNING and require throws E_ERROR.

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed