0

Possible Duplicate:
Reference - What does this symbol mean in PHP?

I have a piece of PHP code I dont understand.

private $request;

    public function checkForConfigRequest($observer) {
        $this->request = $observer->getEvent()->getData('front')->getRequest();
        if($this->request->{self::FLAG_SHOW_CONFIG} === 'true'){
            $this->setHeader();
            $this->outputConfig();
        }
    }

This is the line I am confused about:

if($this->request->{self::FLAG_SHOW_CONFIG} === 'true') 

I did not use "{" after "->" and what "self::" referring to ?

I appreciate if someone help me understand the syntax so I can write the same code later myself. fell free to point me to external references

Community
  • 1
  • 1
zac
  • 4,495
  • 15
  • 62
  • 127

1 Answers1

3

Let's say self::FLAG_SHOW_CONFIG = 'foo'; In this case

$this->request->{self::FLAG_SHOW_CONFIG}

means

$this->request->foo

More info here http://www.php.net/manual/en/language.variables.variable.php.

user487772
  • 8,800
  • 5
  • 47
  • 72