Forum Moderators: coopster

Message Too Old, No Replies

Efficiency Question

include vs function

         

createErrorMsg

12:41 pm on Nov 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The scenario I'm working on is incredibly basic. A user clicks a link containing several variable values in the query string. The script that recieves them will use them to gather data from a database and then add that data into the template page for output.

As I see it, there are two possibe routes to go...

Option 1: includes
(a) $_GET the variables.
(b) Feed the variables to data gathering functions.
(c) Return variables containing the data.
(d) Include files containing portions of page code and calls for variables at appropriate places.

Option 2: functions
(a) $_GET the variables.
(b) Feed the variables to data gathering functions.
(c) Return variables containing the data.
(d) Feed the data variables to functions that write portions of page code using the variables and output the page.

Assuming the end result of both would be identical, is there any compelling reason to use one over the other? Is one less work for the server, or easier to maintain, or faster?

Thanks,
cEM

LeChuck

2:40 pm on Nov 20, 2005 (gmt 0)

10+ Year Member



Yes, the function is much less work for the server.