Form validation doubt

I have a doubt about a piece of code, where we want to check the the values added by the user are already store in an array or not.


$validation_error = "";

$username = "";

$users = ["coolBro123" => "password123!", "......"];


   $username = $_POST["username"];

   $password  = $_POST["password"];

   if (isset($users[$username]) && $users[$username] === $password){

   } else {

I thin I understood the first part if isset($users[$username]) where we should be checking if the username already exists.
But what about $users[$username] === $password)?

what are we doing here? I think we are checking the password, but why not like that

But what about $users[$username] === $password)?

Try calling echo on $users[$username] and $password separately on the line before. You ask a good question because you always want to make sure in conditionals you know what values are being checked.