Forum Moderators: coopster

Message Too Old, No Replies

What does $var->some name mean?

         

littlegiant

10:10 pm on Jul 23, 2008 (gmt 0)

10+ Year Member



Pardon my ignorance by I can't find this in any of my PHP manuals. And I don't even know what to Google for.

I'm seeing PHP code that looks like this:

$var->some_name

As I understand it, this is a variable named 'var' and, well, that's all I know. What kind of operator ( -> ) is that in between? And what's the 'some_name' part that follows? Is that another variable or a function name?

I actually have quite a bit of PHP experience. I just don't know what that kind of code refers to. If you could just tell me what to Google for, I could take it from there.

MattAU

10:23 pm on Jul 23, 2008 (gmt 0)

10+ Year Member



The syntax is used for object-oriented PHP. Have a look at [au2.php.net...]

$var is the object
-> is the bizarre syntax php decided to use for objects
some_name is a member variable contained in the object

littlegiant

10:57 pm on Jul 23, 2008 (gmt 0)

10+ Year Member



Hey thanks very much! I'll read up on that!