11-05-2010, 02:01 AM
Is it a bad idea to store all of my PHP functions in one file? Just have a single file with all my PHP functions in it and call the individual functions as I need them? Or would it be faster to put the each function directly into it's original file?
11-05-2010, 02:18 AM
i prefer to have all of my functions split up into classes in separate files. then i load them as I need them using __autoload()
11-05-2010, 02:34 AM
Like angst, I split them up into different classes/files, but that's merely to categorise them and put them where I think they best belong. Having them in one file is as good as though. Just depends which is your personal preference.
11-05-2010, 03:00 AM
Wouldn't having them in one file be slow? I mean, the server has to run through all the functions until it gets to the one it needs. And is _autoload() better than include()? What's the difference between them?
11-05-2010, 03:05 AM
i would think that technically yes, if you have +100k lines of code in one file it might take a little longer to access the script. but I've never tested.
also, __autoload uses includes, however with autoload it makes my class lib more dynamic. i can added classes and call them as i please without having to declare them in a settings file.