PHP Verifying a password against a hash
password_verify() is the built-in function provided (as of PHP 5.5) to verify the validity of a password against a known hash.
All supported hashing algorithms store information identifying which hash was used in the hash itself, so there is no need to indicate which algorithm you are using to encode the plaintext password with.
If the password_* functions are not available on your system (and you cannot use the compatibility pack linked in the remarks below) you can implement password verification with the crypt() function. Please note that specific precautions must be taken to avoid timing attacks.