I know, this is a weird question, but...
I am working right now on an inherited project, and finding this quite a bit.

$objSomething -> $object

I have had it explained to me that this is similar to the dot in javascript's

element.style

This concept in javascript is not really new to me, it allows me to access and manipulate the style attribute of the named element.

There is a lot of this -> in the code that I am working with. The explination from my friend says that $objSomething is a class and $object is a function within that class.

My questions
1.) what is this symbol called or this technique at least, so that I may look it up and get a better understanding of it.
2.) does the first item have to be a class, and the second have to be a function, or can it $function -> $array.
3.) if it can be an array, can I use those items by index as normal as below?

$myInfo = $objSomething -> $array;
echo $myInfo[0];
echo $myInfo[1];

If $objSomething is in fact a class (as suspected), are there any PHP Native Classes that we have access to? If so, where can I find these.

and last but not least. Does anyone know of a place that has good information about this technique? I want to understand every aspect of it so that I know exactly what this inherited code is doing.

Thank you so much in advance
Sage

It's called the arrow operator, and when using it you don't prepend the member with $, ie.,

class SomeClass{
private $blah = "Hello";

function getBlah(){return $this->blah;}
function setBlah($value){$this->blah = $value;}
}

In another file

$something = new SomeClass();
$myBlah = $something->getBlah();
echo $myBlah; //"Hello"
$something->setBlah("World");
$myBlah = $something->getBlah();
echo $myBlah; //"World"
Comments
Thanks Shawn, your snip on PHP -> was very helpful.

Shawn
This is perfect. Basically this is working with classes.

I'm not new to using PHP at all, but am new to using classes.
This was very helpful stuff.
Thanks
Sage

This question has already been answered. Start a new discussion instead.