Hello, I'm teaching myself php and I came across a problem while learning.
Normally I could google a question, but I can't seem to find anything explaining to me what "->" means. I tried googling, "what does -> mean in php" with no avail. I know it has something to do with assigning data to a variable, but I can't seem to figure out why it is used.
Any explanation would be greatly appreciated!
EDIT: WOW, someone posted this exact question a few minutes ago! Sorry, I didn't see it in time
Newbie Alert :D
Moderator: General Moderators
Re: Newbie Alert :D
Do a tutorial on object oriented PHP and you'll see what it means. since you're learning PHP you would be well advised to do that anyway.
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: Newbie Alert :D
"->" is used in object oriented php. An explanation may not mean much unless you first read up a bit about oop in php; but briefly
is a reference to the property $b of the object $a; while
is a reference to the method (function) $b of the object $a.
Code: Select all
$a->$bCode: Select all
$a->$b()- StedeTroisi
- Forum Newbie
- Posts: 2
- Joined: Wed Jun 09, 2010 6:55 pm
Re: Newbie Alert :D
Before learning OOP, just learn regular PHP. It might be all you need. Remember one word: YAGNI. It means you ain't going to need it.