Thread: include() ?

    #1
  1. No Profile Picture
    AlexDG
    Guest
    Devshed Newbie (0 - 499 posts)
    if **include("file.inc")** is inside a function() or class->function(), will "file.inc" be parsed with the rest of the code in the very begining or only if function() was executed?

    ------------------
    Alex D. G.
    http://www.alexdg.com

  2. #2
  3. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    Only if the function is executed. include() is best used in functions or conditionals.

    require() is parsed no matter what when the main script is parsed. This is best for loops as the file will only be accessed and parsed once. If you use include() inside a loop, the file will have to be accessed and parsed with each loop. Not very efficient.

    HTH

    Rod

Similar Threads

  1. the linker, the include and interdependent classes
    By behco in forum C Programming
    Replies: 7
    Last Post: February 1st, 2004, 08:55 AM
  2. the linker, the include and interdependent classes
    By behco in forum C Programming
    Replies: 0
    Last Post: January 31st, 2004, 01:57 PM
  3. include path problems - after uploading to host
    By alaw in forum PHP Development
    Replies: 2
    Last Post: December 9th, 2003, 06:11 PM
  4. Replies: 6
    Last Post: October 3rd, 2003, 02:01 PM
  5. lnk2001 error msg
    By nobby in forum C Programming
    Replies: 0
    Last Post: August 3rd, 2003, 10:06 AM

IMN logo majestic logo threadwatch logo seochat tools logo