Classes and Objects in PHP 5

Album Cover: Black Holes and Revelations

"Come ride with me through the veins of history. I'll show you a god who falls asleep on the job."
Muse / Knights of Cydonia

Posted on November 01, 2004 10:39 PM in Web Development
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

When I first started using PHP during my final semester of college, it was especially interesting given that I had already learned (or at least thought I had) the ins and outs of dynamic web programming by developing in ASP and ColdFusion. The most noticeable difference right off the bat, for me at least, was PHP's resemblance of the C programming language.

As I moved from the academic world into the vastly different business world and started working more and more with C++, it became quite clear to me how much of the object-oriented idiom of development had been lost on me due to a focus on web programming languages.

Luckily for me, I paid attention in my Computer Science classes and actually did quite well in them, so somewhere along the line I managed to store a lot of OOP knowledge in my head even though it would lay dormant for quite some time.

As I spend more time coding in C++ and less and less (unfortunately) in PHP, I continue to realize the disconnect between the two languages that makes it difficult for someone proficient in one to immediately pick up the other. I suppose this is much harder for a proficient PHP coder than it is a C++ coder, but I still believe there is a disconnect from both sides.

Times may be a changin', though, with the release of PHP 5 and the complete rewrite of classes and objects.

I'm confident that anyone who is just now picking up PHP and learns to program keeping version 5's class and object implementation in mind will have little problem at least grasping the OOP fundamentals required to delve into C++ development.

If you're at all interested in PHP or C++ and have some under-utilized brain cells and some time to kill, give PHP 5's new class and object model a read-through.


Swill on November 02, 2004 at 11:06 PM:

PHP 5.0 will hopefully exceed zend's ability to put out an exceptional IDE. If you are familiar with C, PHP can fulfill any need you have for online application development. In a few articles PHP has been compared to JAVA for its extnsibility and open source community. I honestly feel that if the american sentiment is towards open source solutions, Microsoft doesn't stand a chance with proprietary technology that any modern 13 year old can develop in their spare time. If you are looking for a commercial development environment with a responsive dev commiunity, try php and postgresql for a while.

As for PHP 5, it comes as no hiccup to long term PHP guru's, probably only making objects more accessible. But as with most programming languages, our proprietary methods for accessing PHP data objects already exceeds any built in functionality. Lovely constants though.



Richard on November 05, 2004 at 3:17 AM:

One thing that I've searched again and again for is an explanation of using classes and objects in the real world. I've been through the theory and looked at using them in my code but just can't work out how they should be used. Admittedly, I haven't looked at the article you've linked to yet, (next on the list) so my question is: What is an appropriate use of classes and objects with an e-commerce site?

Apologies if the question sounds naive. I have searched but haven't found an answer of substance yet.


Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.


Email Address:



Check this box if you hate spam.