PHP Equivalent to Ruby's @instance_variable?
问题 I was wondering if there is a shorter, better or cleaner way to assign and use class variables in PHP, then through $this->instance_variable ? class Bar { # internal variables var $foo = "Hello World"; public function foo() { return $this->foo; } } I am not very familiar with all PHP's variable scoping, but from what I understood at the official docs, you can either define them global, or access them trough $this-> ? Is there a keyword to define them as instance variable, so they are