After instruction from Stefan's response to my question on the Killersites.com web-form; I am opening this thread for the sites community to 'jump in' and perhaps for other beginners to benefit from responses to the questions I ask:
After watching Stefan's OOP: PHP videos about classes and objects I have the following questions:
When you have a class which has a fairly large amount of properties (variables) to have a getter or setter method for each of your properties could become very tedious is it OK to create a getter or setter method which collectively works on a group of properties and if so is it OK to break with the convention of naming your getters and setters to accommodate the collective manipulation of class properties? i.e:
class person {
//Class Properties
$height;
$weight;
$age;
//Class Methods
public set_properties($h,$w,$a) // Instead of a setter method for each e.g. set_height, set_weight etc............
{
$this->height = $h;
$this->weight = $w;
$this->age = $a;
}
}
Secondly in Stefan's PHP Videos he declares variables using var:
var $variable1;
Is the var absolutely necessary as I've seen variables without the var keyword and it seems to work OK.