CodeIgniter Forums
Public variable in controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Public variable in controller (/showthread.php?tid=48089)



Public variable in controller - El Forum - 01-04-2012

[eluser]someone Smile[/eluser]
Hello!

I've created some controller with public variable, which I would like to use in all functions. It looks like this:
Code:
<?php
class Test extends CI_Controller {

public $appname = "test";

public function index()
{
  echo $this->appname . " is name of app.";
}
}
?>

Is this way of using variable secure and true or is any other way better?

Thanks! :-)