PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
function setVar($varname, $newvalue) {
// return(void)
// $varname = The name of a variable to be changed
// $newvalue = The new value for the variable
if( emtpy($varname) || empty($newvalue) || !isset($this->class->$newvalue) ) {
// If given arguments are empty, or the variable name does not exist
return false;
} else {
$this->object->$varname = $newvalue;
return true;
}
}
The thing is I wonder when If I need to set a variable value to 0. Then the $newvalue would come as 0 and checking with empty would return false.