Associate
- Joined
- 3 Jun 2008
- Posts
- 411
Really you should write get_data() and set_data($array) methods to be thorough but this should get you started.
Code:
class MY_Controller extends Controller {
private $data = array();
//note __construct() rather than the class_name() which is deprecated
function __construct()
{
parent::Controller();
$this->data = array('1' = > '1', '2' => '2', '3' => '3');
//constructors cannot return $data;
}
}
Code:
class Example extends MY_Controller
{
function __construct()
{
parent::__construct();
}
function index()
{
print_r($this->data);
}
}