on-internet
← Community

php - is it possible to define properties for methods?

Stack Overflow ·

I would like to define some properties in a method that are contained within that method i.e not the the entire class. But want to do this from the instance of the object. Is that possible? The code below does not work. class foo{ var $x; function __construct(){ } function abc(){ echo $y; } } $new = new foo(); $new->abc->y = "bar";

Comments

Sign in or sign up to comment and upvote.

No comments yet.