Reputation: 203
When I use the code below, I get this error:
Fatal error: Call to undefined function passwordHash() in
C:\(...)\index.php on line 38
If I do $something = new accountcreation;
and call it via $somethingn->passwordHash();, I'm able to call the function.
But, how do I call the function the way I want to, from within the class? (See the function: callMethods();)
Thanks.
class accountcreation {
function __construct($passwordCreation, $userCreation,
$ipCreation, $emailCreation, $con) {
$this->passwordCreation = $passwordCreation;
$this->userCreation = $userCreation;
$this->ipCreation = $ipCreation;
$this->emailCreation = $emailCreation;
$this->con = $con;
}
function callMethods() {
passwordHash();
}
function passwordHash(){
$this->passwordCreation =
password_hash($this->passwordCreation, PASSWORD_BCRYPT);
var_dump($this->passwordCreation);
}
}
Upvotes: 0
Views: 21
Reputation: 36487
How about $this->passwordHash()
? :) In comparison to C++ you'll always have to explicitly name this
/$this
.
Upvotes: 2