This is most likely a very stupid question and you would think for someone who has been coding with PHP for 4 years now I would know the answer to it but I've never came across something that I was coding where I needed to use this. What does $variable->SomethingElse do? I've seen it quite often in code but I really have no clue what it really does, nor do I know how I would Google a question phrased to get an answer to that.
Take a look at Object Oriented programming with PHP and that will explain it: http://php.net/manual/en/language.oop5.php I guess you have been doing "procedural programming". That is what I first learnt (and prefer).
lets have a look at the below example:- class UserController extends Controller { public $user_id; public function actionInitialize() { $this->user_id=1; } } PHP: now if you see the above code, its an example of Object oriented programming in Php. where as ' $this ' refers to the object of the Class 'UserController' . Since, $user_id is an attribute of a class so it can be access via:- 1) setters and getters 2) Scope resolution operation (some restriction , as it has to be static) 3)$this
for me that is one of the downside of php, procedural programming, really high level type of programming (more on dynamic websites), but fast implementation though. it will be really hard in programming if you start from php, but not vice versa. ok based on your example $variable->SomethingElse Code (markup): - this is just calling the variable "SomethingElse" inside the class implementation on your variable "$variable" thus $variable->SomethingElse() Code (markup): - this one calls the method/function inside the class implementation on your variable "$variable" (notice the parentheses '()') given this class class Example { $SomethingElse = "HelloWorld"; public function SomethingElse() { return "Hellow" } } Code (markup):