self operator within a double quoted string
| From: | NaMarPi | Date: | Wed, 17 Apr 2013 17:47:03 +0000 |
| Subject: | self operator within a double quoted string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-320862@lists.php.net to get a copy of this message | ||
I would like to use self and static operators inside a double quoted string,
but do not find the way to accomplish that. Could you give me a right direction?
http://3v4l.org/NDkdA
class Foo {
public static $class_prop = 'Class_Property';
public $object_prop = 'Object_Property';
static function printClassProp() {
print 'prefix_' . self::$class_prop . '_postfix' . PHP_EOL;
print "prefix_{\\self::$class_prop}_postfix" . PHP_EOL; //
<-- issue here
}
function printObjectProp() {
print "prefix_{$this->object_prop}_postfix" . PHP_EOL;
}
}
$foo = new Foo;
$foo->printObjectProp();
Foo::printClassProp();