now... I wrote the same answer as Zach, but never the less
- You can use the dummest wayh ever by storing $test into the session
$_SESSION[test]=1234;
var_dump($_SESSION["test"]); // at any place among your app
this probably is the worse possible scenario ever.
-
Depends on the case you can use Cookies, generaly it is also a bad idea, for many reasons. But if the data in this variable is not sensitive you may go for it.
- If there is a form in the view you can
public function testAction() {
$this->view->setVar("MYVAR","1234");
}
inside the view:
<form method="post" bla bla bla>
<input type="hidden" name="test" value="<?php echo $this->view->test" />
</form>
and in the controller action
public function anotherAction() {
print_r($_POST); //$_GET
}
- You can store this value in the database ( depends on the case ) or some mem cache store ( like Redis )
// i was going deep in details but this markdown editor is only screwing with me, i am too nervous to continue now.. let me know if you want more details