Reply
Old 02-25-2005, 08:09 AM -> ??
lajkonik86's Avatar
Ultra Talker

Posts: 389
hey quick and easy question

what the heck does -> do in php ?
I'm using php for a while now and i see it in script but i'm uncertain as what it does


help plz :P
__________________
Know what to Download
http://www.top-download.net
lajkonik86 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 02-25-2005, 10:13 AM
0beron's Avatar
Defies a Status

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)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Reply     « Reply to -> ??
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11907 seconds with 12 queries