Conditional Statement (Mistake 3)
Refer to the following codes:
- <?php
- $password = "ABCDE12345";
- $count = strlen($password); //strlen is a PHP function to calculate how many characters in the variable
- if ($count < 5);
- echo "The password length must be 5 characters and above.";
- if (strlen($name) >= 5)
- echo "Your password is accepted!";
- ?>
It should output "Your password is accepted" since the password length is 10 characters. However, the code's output is "The password length must be 5 characters and above.". Try to fix the codes. Be the one who posts a comment describing what is the mistake with the codes.
Last modified: Saturday, 23 February 2019, 10:11 AM