Hello.

The code below returns an error. Please advise what is wrong with it. Thank you.

class Login {
  private var $good_username;
  private var $good_password;
  public function Authentification () {
    private $this->good_username = "myusername";
    private $this->good_password = "mypassword";    
  }
}

Recommended Answers

All 4 Replies

Member Avatar for diafol
class Login {
  private $good_username;
  private $good_password;
  public function Authentification () {
    $this->good_username = "myusername";
    $this->good_password = "mypassword";    
  }
}

Thank you for reply. I tried your code and also it does not work. The problem is that the code does not work when I use the declarations: public, protected, private. When I remove them, it works, as in the example below.

class Login {
  var $good_username;
  var $good_password;
  function Authentification () {
    $this->good_username = "myusername";
    $this->good_password = "mypassword";    
  }
}

@pritaeas
You are right. I'm using PHP Version 4.3.6. I will update it. Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.