What is processed and when?
I am in the process of writing a CMS as an intellectual exercise and to progress my skills, however there is one question I have never seen a definitive answer to.
Say I want to use a function to generate a loop of results and output the appropriate data on my front end page, should I declare the function on the actual page, or can it go into a master functions page?
Or put another way if I create a large functions file with a load of useful functions in it, does having a 1000 functions file slow down the load of a page if none of the declared functions are called?
Thanx in advance
Does it slow it down? Yes. Is it enough to worry about? That depends on lots of variables.
You can split the difference and combine groups of related functions into files, and only include those files you actually need.
You could take the next step, and enter into the world of object-oriented programming, where things that belong together become class definitions. With some clever use of naming conventions and auto-loading, you automatically only load those classes that you use.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Thanks a lot, I want to start playing around with object orientated php but there is only so much time you can get to work on things
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)