Code:public class someting { private int num = 456; public void doSomething(){ int variable = num + 456; } }
In java, variables on the top can simply be accessed by referring to them, but if I want to access the same variable in PHP, I would have to do this:
Code:$this->num
is there a way to declare a variable in a way that it could be accessed anywhere in the class without $this keyword.
I also want it to be private to other classes.






Hope this helps


Bookmarks