1

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...

1
  • @safarov i know that, i cant see how to fix it... Commented Apr 7, 2012 at 18:14

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.