Here i wan t to share about language variable variable. You can visit complate tutorial here.
What does that mean $this->{$var}?
This is example how to use $this->4{$var}
Working example: http://3v4l.org/QNds9$this->a = "hello"; $this->b = "hi"; $this->val = "howdy"; $val = "a"; echo $this->{$val}; // outputs "hello" $val = "b"; echo $this->{$val}; // outputs "hi" echo $this->val; // outputs "howdy" echo $this->{"val"}; // also outputs "howdy"
This of course is working within a class context. You can use variable variables in a local context just as easily like this:
$a = "hello";
$b = "hi";
$val = "a";
echo $$val; // outputs "hello"
$val = "b";
echo $$val; // outputs "hi"
Working example: http://3v4l.org/n16sk.src: http://bit.ly/14238Mr
Title: PHP, Language Variable Variable $this->{$var}
Posted by Unknown
Thanks for reading about PHP, Language Variable Variable $this->{$var}
Posted by Unknown
Thanks for reading about PHP, Language Variable Variable $this->{$var}