Reputation: 1164
Now we know password_hash
exist on in PHP version 5.5 and above.
So what if the server we are using have older version of PHP?
For that I want to create a condition if function password_hash
exist or not.
I am checking it like this:
if(function_exists('password_hash')){
//do nothing
} else {
// code of password_hash and password_verify
}
I am getting code from here.
So this check is for community.
I am using this in codeigniter helper when i run this it stop password_hash
function and display nothing.
tell me where I am going wrong and how can i do it better way!
Upvotes: 0
Views: 341
Reputation: 3246
I think you should use this piece of code for checking that is there function password_hash
exists or not:
if(!function_exists('password_hash')){
// Not Present hash function
}
else{
// Present function
}
Upvotes: 2