wesley Posted October 2, 2015 Share Posted October 2, 2015 Hello, I have a function that looks at whether there is md5 or sha1 is used. The function would then encrypt the word password. But this he does not. How can I make the variable $method? $methode = md5 (); doesn't work, $method = md5; doesn't work can someone help me? thanks in advance function encrypt($input, $method){ if($method == "md5"){ return md5($input); }else{ return sha1($input) } } $input = "password"; $methode = md5 (); //this doesn't work echo encrypt($input, $method); Link to comment Share on other sites More sharing options...
justsomeguy Posted October 2, 2015 Share Posted October 2, 2015 It's checking for just a string: if($method == "md5"){Neither MD5 nor SHA1 are suitable for passwords though. Link to comment Share on other sites More sharing options...
dsonesuk Posted October 2, 2015 Share Posted October 2, 2015 Wouldn't it help if $methode = md5 (); matched the argument passed in function call encrypt($input, $method); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now