Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

18
  • 4
    This doesn't look like reflection to me. Reflection is a means to examine a class to observe its metadata (which includes things like member names). No metadata is being observed here; rather, a string substitution is being performed. In other words, whether you type the name of the class out yourself or provide it as the value of a variable makes no difference to the PHP interpreter. You're looking at a first-class feature of the language itself. Commented Nov 17, 2017 at 16:00
  • Can you please post that as an answer? Commented Nov 19, 2017 at 7:45
  • Unfortunately I don't know for sure that this is how PHP functions. But since PHP is an interpreter, string substitution is all that is really required to make variable variables work; so it seems unlikely that it could be anything else. Commented Nov 20, 2017 at 2:43
  • 1
    Because the Python and Javascript "interpreters" do not perform the kind of string substitution I describe. Absence of evidence is not evidence of absence. Commented Nov 20, 2017 at 15:55
  • 1
    As I stated before, I don't think simple string substitution counts as reflection. You can perform that sort of substitution in an interpreted language quite easily, without spinning up any additional machinery like you have to in languages like Java and C#. Commented Nov 22, 2017 at 15:41