Jump to content

variable ambiguity with oop


.josh

Recommended Posts

..or something like that. well basically I have this:

parent::$this->config['channel']

and i can't figure out how to put that inside double quotes.  It works just fine if I do this:

echo "blah " . parent::$this->config['channel'] . " more blah";

but I want it to look like this:

echo "blah parent::$this->config['channel'] more blah";

I tried these:
[code]
// <outputs it literally> parent::$this->config['channel']
echo "blah {parent::$this->config['channel']} more blah";

// <outputs it half literally> parent::#phpfreaks
echo "blah {parent::{$this->config['channel']}} more blah";

// <does the same thing as ^>
echo "blah parent::{$this->config['channel']} more blah";
[/code]

but i can't just simply do

{$this->config['channel']}

because it's being echoed inside a class extending another class, hence the parent::

where am i going wrong??

Link to comment
https://forums.phpfreaks.com/topic/27078-variable-ambiguity-with-oop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.