|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-01-25 15:34 UTC] kopelke at gmail dot com
Description:
------------
The complex string syntax will not include static classes. I cannot use them as output.
Quote from doc: In fact, any value in the namespace can be included in a string with this syntax. Simply write the expression the same way as it would appear outside the string, and then wrap it in { and }.
I do expect this to be wrong. The documentation states "any value" and A::$a is a valid value for a string.
Reproduce code:
---------------
class A {
static public $a = 'A';
}
echo "{A::$a}";
Expected result:
----------------
A
Actual result:
--------------
{A::}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 11 17:00:01 2025 UTC |
Also from the same manual page: Note: Functions, method calls, static class variables, and class constants inside {$} work since PHP 5. However, the value accessed will be interpreted as the name of a variable in the scope in which the string is defined. Using single curly braces ({}) will not work for accessing the return values of functions or methods or the values of class constants or static class variables.