Question about functions: where to put them?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mhenke
Forum Newbie
Posts: 21
Joined: Thu Jan 27, 2005 2:20 am

Question about functions: where to put them?

Post by mhenke »

I would like to know what is the best/fastest way to deal with my functions:

Do I put them all in one file, and include the file with each page, or do I split them up, and include only the ones that are needed for that page?

I would appreciate feedback, couldn't find anything about this.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

oft used functions should generally be stored together. Not so oft, in seperate, potentially page related, scripts.. or directly in the file they are used (if only called from a single script)

that's the general route I try to take. Try to avoid including too many files, as each requires php to load and parse that file, along with the harddrive seek time..
Post Reply