Re: Curious if include_once will work better than include

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Curious about "include_once" versus "include".
>
> All my connection stuff is in "conn.php3".
>
> I am planning on including it at the top of the page like this:
> include_once "conn.php3";
>
> Now will that speed things up compared to just using a plain "include". I
> call $connectionSDWIS(which is in the include) 5 different times?

IMHO the 'speed' difference between include and include_once will be
slight, probably with include_once being slower because of the overhead
needed to keep track of which files have been included already.  But this
isn't really what the question is about.  include and include_once will
not magically optimize the code for you, but if you include the same file
20 times that will be more that has to be parsed needlessly, so if you
can't keep track of your includes or if including a particular file more
than once will alter the result, than use include_once. Another
alternative is to use require() or require_once() to make sure that the
file is included.   Just my $.02,

Eric

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux