title: Accessing value of public variable in codeigniter controller
body: <p>Does anyone knows how to access the value of the public controller variable which has been updated by another function?
  code example
  Controller</p>
  
  <pre><code>class MyController extends CI_Controller {
  
  public $variable = array();
  
  function  __construct() {
      parent::__construct();
  }
  
  function index(){
      $this-&gt;variable['name'] = "Sam";
      $this-&gt;variable['age'] = 19;
  }
  
  function another_function(){
      print_r($this-&gt;variable);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>when i call another_function() i get an empty array.. What could be the problem?
  Any help will be apreciated..</p>