My question is one of the best practices for OOP. Im using Codeigniter framework / PHP.
I have a class:
class Test() {
var $my_data = array();
function my_function() {
}
}
Is it possible to declare $ my_data in a class? or should it go in the constructor? Basically, each function will write in $ my_data, so in a sense it will be a class variable (global ?, not sure of the terminology)
Also, should you use var or private? var is deprecated in favor of declaring a variable scope?
source
share