what is the deference between include() and require()?

Discussion in 'PHP' started by webshore88, Sep 18, 2011.

Thread Status:
Not open for further replies.
  1. #1
    what is the difference between include() and require().I think there is very minor difference between them that I don't no. what is your opinion about this
     
    webshore88, Sep 18, 2011 IP
  2. insert

    insert Peon

    Messages:
    148
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you use include, and the script cannot be found, it just throws warning and execution continues. On the other hand, if you use require and the script cannot be found, it will throw an error and the execution of the script will be ended.
     
    insert, Sep 18, 2011 IP
  3. TheDeadLike

    TheDeadLike Member

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #3
    Just as @insert said, think about it as instead of using:
    if(!include("abc.php")) exit();
    PHP:
    you would use:
    require("abc.php");
    PHP:
     
    TheDeadLike, Sep 18, 2011 IP
Thread Status:
Not open for further replies.