I've read tutorial on tutorial and I try to work with Object Oriented PHP but the thing is that I find it rather complex. When I create a class I must include it in the current working document. It doesn't work as in Java when the compiler finds the script in the same folder anyway. And when I always must include that class in different directories it gets really inefficient. Is there a way to achieve what I'm looking for? Or have I completely misunderstood the concept in PHP?

Today I have a script which automatically fixes the correct directory relative from the current working directory and return to me an array with paths so that I can write...


To get the path to the db_class. How should I proceed to achieve effective programming? And how exactly do I use :: ?

Votes + Comments
Very good at explaning things.
7 Years
Discussion Span
Last Post by gunnarflax

What are you using as an editor? Notepad ++? And are you testing the code on a website, or some other type of software?


I'm using Netbeans IDE 6.9.1. The autoloading class is exactly what I'm looking for! But would it be better to include multiple classes into the same php file? What is the most effective way to handle classes and inclusion? How do you guys handle inclusions when working with classes dependent upon another in different directories?


And I don't really know what I mean with ::, all I know is that the source code to wordpress is filled with them x)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.