Concept

How can PHP reference a member variable dynamically?

ComputerScienceOne / Accessor & Mutator Methods

"You can use the syntax $this->$foo but it will assume that $foo is a string that contains the name of another variable, for example, if $foo = \"firstName\"; then $this->$foo would resolve to the instance’s $firstName variable. This is useful if your object has been dynamically created by adding variables at runtime that were not part of the original class declaration."

Related Ideas