I'm just starting to work with OO code, and class files, and am planning to completely revamp one of our sites into object oriented code. I'm wondering what the best way is to do this:
So let's say you have several class files. 4 of them would be ones that might be needed in just about all of your php files, 3 of them will be used somewhat often, and the other 3 will be used rarely.
Option 1: declare your include statements to those class files in a header file, and include that single file in all of your php files. It's easy, but then you're including class files on some pages that you don't actually need.
Option 2: on every php page, include only those class files that you need on that page. More time consuming and requires a bit more thinking, and a bit of a pain in the butt. But, you're not including files that you don't need.
My preference would be to do Option 1, but I'm not sure if this is considered a no-no. Does including class files that you don't need produce a lot of overhead and processing time when loading pages?
Is there some better way of doing this, that I'm not thinking of?