#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Cape Town, South Africa
    Posts
    18
    Rep Power
    0
    Hi there

    Could someone please tell me what the difference is between include() and require()? I'm never sure which one I should use in a particular situation.

    Thanks for clearing this up for me.
    ~Warren
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    Please find out an answer from following link :
    http://www.phpbuilder.com/manual/function.require.php

    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    73
    Rep Power
    15
    However, since require always put the external code in, should it be less efficient than include?
    Like in a script, you have several if statements, depend on which branch the user want to go. In this case, should we use include() in each branch?

    ------------------
    http://new.123finder.com/ - Helps you find cool domains for FREE & Registers it for only $14.95/yr
    http://www.guideclick.com/ - Qualified webmaster resources (affiliate programs, web design, tips)

    ------
    Son
  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    That's correct.

    In a conditional the file should be called with include().

    In a loop the file should be called by require() (unless the file name is dynamic and might change.)

Similar Threads

  1. Replies: 1
    Last Post: February 5th, 2004, 10:38 AM
  2. Require authentication using perl on a html page
    By igiveadamn in forum Perl Programming
    Replies: 0
    Last Post: November 14th, 2003, 10:34 AM
  3. callback function and require or require_once
    By dave_mwi in forum PHP Development
    Replies: 2
    Last Post: November 7th, 2003, 10:54 AM

IMN logo majestic logo threadwatch logo seochat tools logo