php bestpassword encryption code example
Example 1: password hash php
$hashed_password = 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();
}