Posts: 1,832
Location: Somewhere else entirely
|
It's used to call a member function or access a data member of a PHP class. If you are familiar with Object Oriented programming then it will make sense, but if not then heres a quick explanation.
PHP allows you to define 'classes' which are like recipes for creating objects. They can have within them data, and functions. I am not sure of the class definition syntax in PHP since I've never really had the need to use it.
Say we define a class called 'MyName'. We give it a string for data, and a function called sayName() that causes them to print the string. We then have a recipe for MyName objects.
Then you can build two objects of type MyName, call them MN1 and MN2, but store different data in their strings. Then when you say MN2->sayName(); you get a different result to MN1_>sayName();
This is a really simple example, and I can't write it in code without getting it wrong. Classes really become useful for complex projects. You can build your own customised types. Say you want an online shopping system - you might define a class called customer with data such as address, credit card no etc, but also with functions such as sendInvoice() and addToCart($item). You can then create hundreds of these customer objects and they all exist independently of each other and behave as you would expect.
Also when you come to add functionality to a class, you change one class definition, and suddenly all your customers have extra data/functions.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Scribble Pad MOD for phpBB (aka MSN handwriting for forums)
|