Create a new PHP file called stringlength.php and add this in the block of PHP under the h1:

$password="password ";
$minimumPasswordLength=8;
$passwordLength=strlen($password);
if($passwordLength<$minimumPasswordLength){
    die("Password too short.");
} else {
    echo "<p>Password valid</p>";
}

The password would have come from a form when someone is signing up for site.  The site insists that passwords must be 8 characters or more long and this checks for that.  Don't worry about the space at the end of the password that is used later.

Try it.  Test it by changing the $minimumPasswordLength value from 8 to 10 (at the top of your code) and you should get the error message and the PHP will stop executing because of the die.