Reputation: 381
when I try to initialize variable while declaring I get syntax error: unexpected T_VARIABLE.
Here is my code:
class TagProduct extends CI_Controller {
// num of records per page
private $limit = 10;
private $CurrentDate;
private $LoginID=$this->session->userdata('UserID');
private $Errmsg=array(
'TagErr'=>'',
'ProductErr'=>'',
);
function __construct()
{
parent::__construct();
Upvotes: 0
Views: 51
Reputation: 3252
Properties must be initialized by constants in PHP:
Use Structure like this:
class TagProduct extends CI_Controller {
private $limit;
function __construct() {
$this->limit = 10;
}
}
Upvotes: 2