PHP Equivalent to Ruby's @instance_variable?

ptthanh

New Member
I was wondering if there is a shorter, better or cleaner way to assign and use class variables in PHP, then through \[code\]$this->instance_variable\[/code\] ?\[code\]class Bar { # internal variables var $foo = "Hello World"; public function foo() { return $this->foo; }}\[/code\]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 \[code\]$this->\[/code\]?Is there a keyword to define them as instance variable, so they are accessible like Rubys @variable?
 
Back
Top