title: Using a private variable in a controller
body: <p>I'm developing a website using CodeIgniter.</p>
  
  <p>I have declared a controller, in this controller class I added a private variable as an array, and I filled this array with informations from the session class.</p>
  
  <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
  class Admin extends CI_Controller{
  
      public function __construct()
      {
          private $data  = Array('');
  
          parent::__construct();
          $this-&gt;data = Array(
              'nom' =&gt; $this-&gt;session-&gt;userdata('admin_fullname')
          );
      }
  </code></pre>
  
  <p>In some methods I have to call this variable as:</p>
  
  <pre><code>public function dashboard(){
      $this-&gt;load-&gt;view('admin/header', $data);
      $this-&gt;load-&gt;view('admin/left_navigation');
      $this-&gt;load-&gt;view('admin/dashboard');
      $this-&gt;load-&gt;view('admin/footer');
  }
  </code></pre>
  
  <p>But it gives me this error :</p>
  
  <blockquote>
    <p>#A PHP Error was encountered Severity: Notice Message: Undefined
    variable: data Filename: controllers/admin.php Line Number: 73</p>
  </blockquote>
  
  <p>The line number 73 is : <code>$this-&gt;load-&gt;view('admin/header', $data);</code></p>