php password_hahs code example
Example 1: php hash password
$pass = password_hash($password, PASSWORD_DEFAULT);
password_verify($password, $hashed_password);
Example 2: php hash password
$host = 'localhost';
$user = 'myUser';
$passwd = 'myPasswd';
$schema = 'mySchema';
$pdo = NULL;
$dsn = 'mysql:host=' . $host . ';dbname=' . $schema;
try
{
$pdo = new PDO($dsn, $user, $passwd);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $e)
{
echo 'Database connection failed.';
die();
}