1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ierofanga [76]
4 years ago
8

Write a php program that checks the elements of a string array named $passwords. use regular expressions to test whether each el

ement is a strong password. for this exercise, a strong password must have at least one number, one lowercase letter, one uppercase letter, no spaces, and at least one character that is not a letter or number. (hint: use the [^0-9a-za-z] character class.) th e string should also be between 8 and 16 characters long.
Computers and Technology
1 answer:
Naya [18.7K]4 years ago
6 0

<?php

function pass_strong($candidate) {

   if (!preg_match_all('$\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S [\W])\S*$', $candidate))

       return FALSE;

   return TRUE;

}

/*

   Explaining

   $\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])(?=\S*[\W])\S*$

   $ = string beginning

   \S* = characters set

   (?=\S{8,}) =  with length atleast 8

   (?=\S*[a-z]) = with at least 1 letter that is lowercase

   (?=\S*[A-Z]) = with at least 1 letter that is uppercase

   (?=\S*[\d]) = with at least 1 number

   (?=\S*[\W]) = with at least 1 special character

   $ = string end

*/

$Passwords = 'password01';

if(pass_strong($Passwords))

   echo "$Passwords is a strong password<br />";

else echo "$Passwords is NOT a strong password<br />";

?>

You might be interested in
Why is my computer acting up?
FromTheMoon [43]

Explanation:

you may need to restart the computer. if that doesnt help clear any cache you have. delete anything taking up space.

8 0
4 years ago
Ross has to create a presentation for his class but can't decide on a topic. What should he do?
dmitriy555 [2]
The answer is C. Choose a topic that he is interested in and wants others to know more about.
3 0
4 years ago
Read 2 more answers
Can the redirection shell metacharacter be used to redirect between a command and another command?
Maksim231197 [3]
The answer is NO it cannot.
5 0
4 years ago
What are some causes of the number of bytes on the wire exceeding the number of bytes being captured?
Aneli [31]
<span>Some causes of the number of bytes on the wire exceeding the number of bytes being captured is that </span>not everything is being captured or that partial packets may be captured which could lead to incorrect analysis. If there are regularly more bytes on the wire than captured, then, it is possible that the computer on which Wireshark is running is not able to keep up with the interface.
7 0
3 years ago
Read 2 more answers
This refers to the people involved in the data processing operation.
yawa3891 [41]
The people involved in the data processing operation are known as <span>Peopleware.</span>
6 0
3 years ago
Other questions:
  • Your browsing the Internet and realize your browser is not responding which of the following will allow you to immediately exit
    14·2 answers
  • The text discusses three different steps when processing input. Which of the following is (are) one of those steps? (Check all t
    8·1 answer
  • One factor affecting digital camera quality is the number of pixels, measured in ____, used to store the data for each image.
    8·2 answers
  • How do i end my current plan that i never signed up for, the basic one it charged me $24
    11·2 answers
  • Yo, my Lenovo laptop keeps showing this screen but I can't sign in, can someone help me?
    5·2 answers
  • Suppose the CashRegister needs to support a method void undo() that undoes the addition of the preceding item. This enables a ca
    6·1 answer
  • 1 #include 2 3 int max2(int x, int y) { 4 int result = y; 5 if (x &gt; y) { 6 result = x; 7 } 8 return result; 9 } 10 11 int max
    12·1 answer
  • Usually it is a rectangular box placeed or underneath your desk​
    15·1 answer
  • Which of these is NOT an input device?
    14·1 answer
  • Make a Flow Chart From this C Programming Language Code
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!