Chris, thanks for describing your method. The reason I really dislike
Functions in PHP is because you have to pass every variable needed by a
function, even if that variable is global in the main script, which is a
pain in the ass when a function needs a long string of variables. It makes
it easier to forget a variable in the list and can make the code look messy.

So, that's why I prefer includes, because the code is operating on the same
level as the main script and can easily use variables set locally without
making them global.

I'll use a function if it only needs one or two variables passed to it, but,
I find myself using more Includes than Functions because of the variable
passing necessary.

Includes vs. Functions? How about includes that have functions, which a lot
of developers do. For instance, I have a function set up for database
connections. I use it by including it with pages that require database
connections. I think this probably should be Functions vs. Blocks of Code
(that might be placed in an included file). Actually I see this as being
potentially messier, IMHO. I will have to remember many variable names that
are used in the included file, rather than passing variables I am using
locally to functions with clearly thought out names. Example;

a. I need a variable to hold this standard deviation result. Since I do the
stdv calculation in the block I included I need to go see what the name of
the variable is and use that, so I don't muck up the code.

b. calcStdDev($myCurrentVariable); oh, I need one for here too so,

I just think that you are selling yourself short, and ultimately your code
will be harder to document and maintain. Using blocks is OK, if that block
can be 'functionalized' I say do it.

For efficiency in processing it really will not make much difference in an
included file whether that file is blocks, or functions.


"You’re just jealous because the voices are talking to me"

* Want to meet other PHP developers *
* in your area? Check out:          *
* http://php.meetup.com/            *
* No developer is an island ...     *

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

Reply via email to