Preamble

The hardest thing to learn (and teach btw,) in object oriented PHP is the basics. But once you understand them, the rest will come much, much easier.

But don't be discouraged! You just found the easiest to understand tutorial out there on OOP and PHP. It may sound like a boastful claim, I know, but that's what the nerd zeitgeist is saying.

… Or so I've been told.

About This Tutorial

This tutorial is designed to teach total beginners object oriented PHP.

This is not a long-winded theoretical blathering that you see all too often; instead, we actually start writing OO code very quickly. I believe that this 'hands-on' style of learning, makes understanding OO (object oriented) PHP much easier... and less boring too!

So before you begin, get out your favorite PHP code editor and be ready to write and run some object oriented PHP code.

PS: scroll to the bottom of the page for the supporting videos.

Thanks for reading,
Stefan Mischook

Introduction

With the release of php5 in 2004, php programmers finally had the power to code with the 'big boys'. Like Java and C#, php finally had a complete OOP infrastructure.

In this tutorial, you will be guided (step-by-step) through the process of building and working with objects using php's built-in OOP capabilities. At the same time you will learn:

  • The difference between building a php application the old fashioned (procedural) way, versus the OOP way.
  • What the basic OOP principles are, and how to use them in PHP.
  • When you would want to use OOP in your PHP scripts.

People run into confusion when programming because of some lack of understanding of the basics. The basics are really important!

With this in mind, we are going to slowly go over key OOP principles while creating our own PHP objects.  With this knowledge, you will be able to explore OOP further.

OOP Videos

The following videos are designed to supplement the article, but they are not required to do the tutorial.

Created By Stefan Mischook  |  Top of page  go to top of page