Hello,
Need help making a decision, not sure which way to go with the class I’m trying to design. The class essentially allows variables to be set, retrieved and validated.
An example of the current code I’m using is
[code=php]
Class MyClass{
$details = array(
“address” => array(“required” => true, “maxlength” => 50, “value” => “”),
“town” => array(“required” => true, “maxlength” => 20, “value” => “”),
“state” => array(“required” => true, “maxlength” => 20, “value” => “”),
);
//other code
}
but I’m not sure if I should be using a class to describe these variables for instance;
[code=php]
class Detail {
var $required;
var $value;
var $maxlength;
//constructor etc
}
class MyClass {
var $address = new Detail(true, 10, 20);
var $town = new Detail(false, 10, 20);
// etc
}
I don’t know if you guys think that this is a minor issue or not but I’m not really sure which way is better.