My webhost doesn't allow usage of PHP 5.5.9 and I need to use the hash_equals() function.
Is there any alternative to this?
Maybe try:
if(!function_exists('hash_equals')) { function hash_equals($str1, $str2) { if(strlen($str1) != strlen($str2)) { return false; } else { $res = $str1 ^ $str2; $ret = 0; for($i = strlen($res) - 1; $i >= 0; $i--) $ret |= ord($res[$i]); return !$ret; } } } Code from: asphp at dsgml dot com
Copied from the PHP comments.
if(function_exists) (without !)? Seems to me now it says, if function hash_equals does not exists, do hash_equals, else...
asphp at dsgml dot comon the hash_equals() PHP Docs page provides code that can be used with earlier versions of PHP