Welcome Guest, Not a member yet? Register   Sign In
global variable in controllers
#1

[eluser]brian88[/eluser]
For my controller, I was wondering how to use the same variable for more than 1 function.
Code:
class Main extends CI_Controller {
  function __construct() {
    parent::__construct();
    $v = "23";
  }

  function index() {
    echo $v; // doesnt work, undefined var
  }
}


Messages In This Thread
global variable in controllers - by El Forum - 06-04-2012, 01:39 PM
global variable in controllers - by El Forum - 06-04-2012, 02:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB