Hi all,
My question is, if you have a function function set ($What, $Value), how do you switch the $value is the value can be anything?
Here is my code:
function Set ($What,$Value) {
//this function sets the value of class variables for the user. All error
//checking to ensure data integrity should be done in here. This function
//should use a switch statement similar to the one in get.
switch ($What){
case 'ID':
return $this->ID;
break;
case 'BillName':
return $this->BillName;
break;
case 'DueWhen':
return $this->DueWhen;
break;
case 'Amount':
return $this->Amount;
break;
case 'error':
return $this->error;
break;
default:
$this->error = "Invalid variable ($What) passed to Set.<br>\n";
return 0;
} //end switch $What
switch ($Value){
case $Value:
return $this->$Value;
break;
default:
$this->error = "Invalid variable ($Value) passed to Set.<br>\n";
break;
} //end switch $Value
return 0;
} //end Set
is the switch for $Value correct?