Unexpected PHP Parse Error -


i realise answer question going obvious, stumped.

i've created class uses jeremy kendall's password validator (https://github.com/jeremykendall/password-validator) called hash. however, when class gets called get:

parse error: syntax error, unexpected '}' in /home/james/projects/rec/htdocs/classes/hash.class.php on line 24. 

the code in hash.class.php having issues is:

private $validationcallback;  public function __construct(){     $this->validationcallback = function($credential, $passwordhash){         if (has('md5', $credential) === $passwordhash) {             return true;         }         return false;     } } 

line 24 final '}'. appreciated.

thanks.

this should be:

private $validationcallback;  public function __construct(){     $this->validationcallback = function($credential, $passwordhash) {     if (has('md5', $credential) === $passwordhash) {         return true;     }     return false; }; // missing semicolon needs here } 

please see php's anonymous function documentation:

closures can used values of variables; php automatically converts such expressions instances of closure internal class. assigning closure variable uses same syntax other assignment, including trailing semicolon:


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -