I am creating some classes in php
and I have the following doubt:
for methods get
and set
in php
, I mounted as follows:
class User
{
private $username = '';
private $password = '';
public function setPassword($password){
$this->password = encript($password);
}
public function getPassword(){
return $this->password;
}
function encript($data){
return sha1($data);
}
}
But when I call it $user->setPassword(1234)
of error função encript() não definida
, where is the error? I do not know much about php
but I've already done it that way in other languages and it usually works, what's the problem?