Validation Patterns
Length Checks
Check whether a string is long enough.
Length Checks
length_check.php
<?php
$password = ;
$length = strlen($password);
$status = $length >= 6 ? "strong" : "short";
echo "length=" . $length . "\n";
echo "status=" . $status . "\n";
<?php
$password = ;
$length = strlen($password);
$status = $length >= 6 ? "strong" : "short";
echo "length=" . $length . "\n";
echo "status=" . $status . "\n";
<?php
$password = ;
$length = strlen($password);
$status = $length >= 6 ? "strong" : "short";
echo "length=" . $length . "\n";
echo "status=" . $status . "\n";
length-check
Length validation records both the measured length and the decision that uses it.