Follow the examples provided in PHP the Right Way under password hashing:
require 'password.php';
$passwordHash = password_hash('secret-password', PASSWORD_DEFAULT);
if (password_verify('bad-password', $passwordHash)) {
// Correct Password
} else {
// Wrong password
}
DO NOT under any circumstances “invent” your own algorithm. These are notoriously tricky to get right and unless you have a background in cryptography you will almost certainly get it dangerously wrong.
4
solved php need working code as example of password hashing