Hi guys,
I have been using mainly procedural php over the past months but now I am writing oo scripts and I have a question about public and private attributes.
I once believed that public attributes declared at the top of a class like:
public $var = 2;
were accessible for manipulation by all member functions without the object reference but now I find that in my php programs, I can only give them visibility to one another by using $this->var.
Why can’t a method doit() access and manipulate a variable using $var? Why do I have to keep using the object reference?
thanks