How does the use of a salt in PHP impact the process of password hashing and verification for user authentication?
When hashing passwords for user authentication in PHP, adding a salt helps increase the security of the hashed password. A salt is a random string of characters that is added to the password before hashing, making it more difficult for attackers to crack the hashed password using rainbow tables or other precomputed methods.
```php
$password = 'user_password';
$salt = 'random_salt_string';
$hashed_password = hash('sha256', $password . $salt);
```
In this code snippet, we first define the user's password and a random salt string. We then concatenate the password and salt before hashing them using the SHA-256 algorithm. This ensures that even if two users have the same password, their hashed passwords will be different due to the unique salt added to each.