Jump to content

What does -> mean?


Shadow Wolf

Recommended Posts

I am not that skilled with php but have a real basic understanding of the syntax. I'm trying to learn it and most of things I get but then I get confused when I encounter things like ->. I don't understand what that means. For example the function below, we have the the variable:

$this->ipsclass->vars['gallery_images_path'] . '/' . $dir . $image['masked_file_name']

 

So from what I see, the variable is $this and I understand $dir is the directory variable and if I echo it, I'll get the directory. $image['masked_file_name'] is the image name variable, echoeing it will show the image name. But the part I don't understand is

$this->ipsclass->vars['gallery_images_path']

 

I don't understand what the -> means. Is it that it is telling me that $this becomes ipsclass which becomes vars['gallery_images_path']? So if I need to call upon that variable is it just vars['gallery_images_path'] or do I have to use the whole string or am I just completely wrong?

 

Can anyone point me someplace to read up on what -> means or help explain it to me in simple terms? Thank you.

Link to comment
https://forums.phpfreaks.com/topic/41876-what-does-mean/
Share on other sites

Ok... I'm sorry but I'm a bit slow on the uptake. I have read the FAQ but it doesn't explain in terms that I really understand.

$this->ipsclass->vars['gallery_images_path']

 

It is used to call variables from within an object... doesn't explain how the above translates into the example.

 

$this = the object?

 

So $obj->bar(); is actually just doing the falling code:

    function bar() {
        echo "Bar initiated";
    }

 

$this->ipsclass->vars['gallery_images_path'], since it has multiple -> does that mean it is an object calling upon another object. So the object $this is calling upon ipsclass which is calling upon vars to call upon ['gallery_images_path']?

 

So if I want to find out what the whole thing means, I need to look through the code to find the object ipsclass and vars? Is that correct?

Link to comment
https://forums.phpfreaks.com/topic/41876-what-does-mean/#findComment-203134
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.