Mask Mask - 20 days ago 8
PHP Question

How do I add a new member variable in PHP?

I want to do something like:

class Name{
function assign($name,$value){
}
}


Which is pretty much the same as
assign
in smarty:

$smarty->assign('name',$value);
$smarty->display("index.html");


How do I implement this?

Answer
class Name {
   private $values = array()

   function assign($name,$value) {
       $this->values[$name] = $value;
   }
}