Code: Select all
<?
// Set up variables
$password = "rand0m";
$subpass = "rand0m";
// Use function, will return true
if (strcmp($password, $subpass) == 0) { #if the functions are the same, it will return 0
echo "These strings are equal<br>";
}
else {
echo "These strings are not equal<br>";
}
// Unequal
$password = "sprand0m";
if (strcmp($password, $subpass) == 0) { will not return 0
echo "These strings are equal";
}
else {
echo "These strings are not equal";
}
?>For more info: www.php.net/strcmp

