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
WHAT DOES THE SCRATCH CODE BELOW DO?
Vinil7 [7]
I think it’s b vertically
7 0
3 years ago
Whats in a computer?
kenny6666 [7]
A lot of things are in a computer there a motherboard, A cpu, A hard drive etc. A motherboard is the computer system  bascilly its the heart for a computer. The cpu is the the brain of a computer it controls on your computer and keeps it going good. finally a hard rive is the memory of your computer it stores all the data including files, photos, etc
8 0
4 years ago
Read 2 more answers
A(n) _____ is a local connection point-of-presence that connects a variety of high-performance networks, and its main function i
kirza4 [7]

Answer:

GigaPOP

Explanation:

<em>A gigabit point of presence, also known as GigaPOP is a single entry point to Internet2, which is a high-speed IP network managed by institutions and other organizations. Gigabit Points of Presence generally handle data transmission rates of one gigabit per second or more.</em>

8 0
2 years ago
How Mobile App work? Explain​
Marat540 [252]

Explanation:

Mobile Applications are moving away from the embedded software systems normally found on PCs.Instead,each application provides limited and isolated functions,such as a game,a calculator or mobile web browing.

8 0
3 years ago
1. In the canonical form ,the no of variables is?
andrey2020 [161]

The canonical form of a positive integer in decimal representation is a A finite sequence of digits that does not start with zero. More generally, for a class of things on which an equivalence relation is defined, a ecclesiastical form consists in the choice of a specific object in each class.

<h3>What is inequality constraints?</h3>

Number of inequality constraints: While there is a restriction on the number of separate equality constraints, there is no restriction on the digit of inequality constraints.

<h3>What is equality and inequality constraints?</h3>

Terminology. If an inequality constraint holds with equivalency at the optimal point, the constraint is said to be binding, as the issue cannot be varied in the direction of the constraint even though doing so would enhance the value of the objective function.

To learn more about  canonical form, refer

brainly.com/question/14398127

#SPJ9

8 0
1 year ago
Other questions:
  • Match the feature to its function. 1. Normal view provide rows of icons to perform different tasks 2. Notes view an area in whic
    15·2 answers
  • I have a question about a hotel tv:
    10·1 answer
  • If you combine two cells into one, what action are you performing?
    12·2 answers
  • Take the hypothetical situation that your business is considering a move to the cloud for core systems that contain confidential
    8·1 answer
  • Which of the following is not a responsibility of a member of society?
    14·1 answer
  • How many frames per second can a half duplex traditional gigabit ethernet handle?
    12·1 answer
  • What is the use of comma and semicolon with print statement ?​
    11·1 answer
  • I umm… really need helpp<br> Can someone help me out <br> I’ll even mark u as brainiest !
    12·1 answer
  • Match the parts of a CPU to their functions. Thanks in advance.
    7·1 answer
  • In this assignment, you will implement an online banking system. Users can sign-up with the system, log in to the system, change
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!