Reputation: 5860
My PHP Code
:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class admin extends CI_Controller {
function __construct(){
parent::__construct();
$this->load->helper('ajax');
}
private $password = 'password';
private $login_details = array(
'username' => 'username',
'password' => sha1('salt'.$this->password)
);
the above code
returns the following PHP
error:
Parse error: syntax error, unexpected '(', expecting ')'
i am using codeigniter but i dont think that this has something to do with the problem since its PHP based...
Upvotes: 1
Views: 254
Reputation: 360762
Class members have to be initialized with static values. You can't use a function result in the initialization, so
'password' => sha1('salt'.$this->password)
is forbidden. You'll have to do that in the constructor instead.
Upvotes: 2