{ $name = $var->getName(); $this->vars[$name] = $var; } public function getVar($name) { if (isset($this->vars[$name])) { return $this->vars[$name]; } } public function getVars() { return $this->vars; } } TestProblem::test(); class TestProblem { public $problem; public $data; public function define() { $p = ProblemFactory::newProblem("Test"); $x = $p->variable('X', 1, 10); $y = $p->variable('Y', 1, 10); $z = $p->variable('Z', 1, 10); $r = $p->variable('R', 1, 10); $vars = array($x, $y, $z, $r); $p->post($x, '<', $y); $p->post($z, '>', 4); $p->post($x->plus($y), '=', $z);