Learning PHP and MySQL

Example 11-11 Calculating the length of a string

<?php
     $password
="secret1";

     if  (
strlen($password)  <=  5)
     
{
        
echo("Passwords  must  be  a  least  5  characters  long.");
      
}
      
else  {
         
echo  ("Password  accepted.");
       
}
?>

This password code above displays the screen in Figure 11-11.

Posted by on 08/18 at 05:52 PM

Next entry: Example 11-12 Using the word case functions

Previous entry: Example 11-10 Using sprintf with a variable

<< Back to main