Ok I'm confused now why it $this-> always used inside methods (inside classes)? I mean what does it do? I know it makes a reference, but I'm still kind of confused?
$this is a pointer to the current object of the class. Meaning if you are working with the class $foo, that has a member variable $var, when working with objects from that class, you can use $this->var to access the current object's $var.
So the idea of an object is that everything inside of it is part of the object rather than just splattered into the global namespace. In other words, if you have 2 methods inside your object -- say, getStuff() and setStuff() -- then you can't just call 'em from anywhere. They aren't visible everywhere. If you have a third function and you try to call getStuff() raw, just like that, it won't work. Why? Because getStuff() is part of the object. It isn't visible to other code. So you have to call it as part of the object, like this: $objectName->getStuff(). Well, when you're INSIDE the object, you wouldn't create an object to talk to itself. It's already created. So when one part of an object wants to use another part of the same object, it uses $this, as in, "the object I'm inside of, dude." So this is how setStuff() might call getStuff(): $this->getStuff(). It means, "run the method that's in the same class that I'M in."