on-internet
← Community

PHP Create Local Variables From String [duplicate]

Stack Overflow ·

Is there a way to create a variable inside an object from a string? for example: class Whatever { public function createVariables() { $this["variable_name"] = 100; } } I want to dynamically create variables depending on a set of rules that are defined by a child class.

Comments

Sign in or sign up to comment and upvote.

No comments yet.