Bob McConnell wrote:

But defining objects and then figuring out how to create and use them
completely escapes me. My mind simply won't map a problem into objects,
it only sees procedures. Even when I look at classes, they resolve only
as loose groupings of functions and variables, not as unified

If anyone knows how to fix that, please tell me. In the meantime, in my
continuing effort to eschew obfuscation, I will stick with procedural

As an experienced programmer, please don't laugh too hard at my functions within my class - but maybe this will help you:

Other than little piddly stuff (that is just as easily done as a function, first class I wrote.

A simplified example of it's usage -

What it does is operate on a DOMDocument object.

I'm not really that fond of OO programming either, but in this case it made more sense to view the document to be filtered as objects (xml DOMDocument objects) because it made what the filter does much easier to program.

Since I was to be operated on object it made sense (to me anyway) to do it as a class instead of procedure functions.

However you will notice that all the class really is - is a bunch of variable definitions (some public, some private) and procedural functions. It's just that they operate only within the scope of the DOMDocument object they are told to operate on.

One thing to note - if a function has the same name as the class, it is a constructor and will be run when a new instance of the class is initiated and it MUST be a public function (why I don't understand, I'd prefer it if I could make it private yet still called when a new instance of a class is created).

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to