Linked by John Collins on Wed 21st Apr 2004 06:42 UTC
General Development The purpose of this article is to give a novice programmer the basic idea of what OOP is, as implemented using PHP. Readers should have a basic knowledge of programming ie what variables are, variable types, basic methods of writing comments, and how to enter code into a text editor.
Permalink for comment
To read all comments associated with this story, please click here.
RE: new to OO
by Anonymous on Thu 22nd Apr 2004 05:44 UTC

as someone new to oop, why would you use class Student, then turn around and make a function Student..

When you make a function with the same name as the class name within the class, this is a special function called a constructor. This function is called when an object of the class is created. Remember that the class is a guideline for making objects. This is explained in the article...

i have no idea what you are talking about when you refer to $a_student = new Student(fdsa,fdsaf); ...

$a_student is an an object of class Student (if you want to be more fancy, $a_student is an an instantiation of class Student). We designed a class called Student, and now we are actually creating a Student by using new. The fdsa,fdsaf are values that are passed to the constructor.