This depends upon what you mean by "effective".  For administration
purposes, it may be that you want to include some "commen" code,
and therefore not rewrite reusable bits.

If you are talking about speed, opening a file is expensive
because it is a kernel call, a directory search and all that.
Your "some big code" in-line will beat it every time...

If you require, and the thingy has been already loaded, then
you will have to analyze how many times you use it, and
try to determine tradeoffs.  This is difficult.

My take is, unless you are getting 100,000 hits a day and
your server load is 0.99, do what is best for reusability,
clarity, and administration purposes.

_jef

--------------------------------------
Adrian Ciutureanu wrote:
> 
> Is any of the versions below more effective?
> 
> /** Version 1 **/
> <?
>     if($condition) {
>         // some big code
>     } else {
>         // other big code
>     }
> ?>
> 
> /** Version 2 **/
> <?
>     if($condition) {
>         include 'file_with_some _big_code.php';
>     } else {
>         include 'file_with_other_big_code.php';
>     }
> ?>
> 
> /** Version 3 **/
> <?
>     if($condition) {
>         require 'file_with_some _big_code.php';
>     } else {
>         require 'file_with_other_big_code.php';
>     }
> ?>
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
Justin Farnsworth
Eye Integrated Communications
321 South Evans - Suite 203
Greenville, NC 27858 | Tel: (252) 353-0722

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to