So here is my code, the problem is that i get strcmp() output as 5 when i enter the password 'malik' in both the fields when it should obviously be 0, i will attach an image to make myself clear. Also, I tried using var_dump($upassword) and var_dump($ucpassword) and I got String(5) for both of them, so there are no whitespaces.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Sign-UP</title>
</head>
<body>
<form action="signup.php" method="post">
<input type="text" name="uname" placeholder="enter the username">
<input type="email" name="uemail" placeholder="enter the email" id="">
<input type="password" name="upassword" placeholder="Password">
<input type="password" name="ucpassword" placeholder="confirm password">
<button type="submit" name="registor">Registor</button>
</form>
</body>
</html>
<?php
if (isset($_POST['registor'])) {
$uname = $_POST['uname'];
$uemail = $_POST['uemail'];
$upassword = (string)$_POST['upassword'];
$ucpassword = (string)$_POST['ucpassword'];
echo($uname."<br>");
echo($uemail."<br>");
echo($upassword."<br>");
echo($ucpassword."<br>");
if($uname == '' || $uemail == '' || $ucpassword = '' || $ucpassword = ''){
die("Please fill all the fields");
}
echo(strcmp($upassword,$ucpassword));
if(strcmp($upassword,$ucpassword) != 0){
die("Passwords are not the same");
}
}