- password_hash: documentation ( source)
- password_needs_rehash: documentation ( source)
- md5: documentation ( source)
<?php
$userPass = 'password';
$pass = md5($userPass);
$options = ['cost' => 12];
if (password_needs_rehash($pass, PASSWORD_DEFAULT, $options)) {
echo password_hash($userPass, PASSWORD_DEFAULT, $options);
}