WHILE loops execute "while" a condition is true.

Looping through a while loop - increment

This is loop number: 1
This is loop number: 2
This is loop number: 3
This is loop number: 4
This is loop number: 5
This is loop number: 6
This is loop number: 7
This is loop number: 8
This is loop number: 9
This is loop number: 10

Looping through a while loop, step 2

This is loop number: 1
This is loop number: 3
This is loop number: 5
This is loop number: 7
This is loop number: 9

Looping through a while loop - decrement

This is loop number: 10
This is loop number: 9
This is loop number: 8
This is loop number: 7
This is loop number: 6
This is loop number: 5
This is loop number: 4
This is loop number: 3
This is loop number: 2
This is loop number: 1
This is loop number: 0

Looping through a while loop - decrement, step .5

This is loop number: 10
This is loop number: 9.5
This is loop number: 9
This is loop number: 8.5
This is loop number: 8
This is loop number: 7.5
This is loop number: 7
This is loop number: 6.5
This is loop number: 6
This is loop number: 5.5
This is loop number: 5
This is loop number: 4.5
This is loop number: 4
This is loop number: 3.5
This is loop number: 3
This is loop number: 2.5
This is loop number: 2
This is loop number: 1.5
This is loop number: 1
This is loop number: 0.5
This is loop number: 0

FOR loops execute loops a certain number of times - increment

This is loop number: 0
This is loop number: 1
This is loop number: 2
This is loop number: 3
This is loop number: 4
This is loop number: 5
This is loop number: 6
This is loop number: 7
This is loop number: 8
This is loop number: 9
This is loop number: 10

FOREACH loops are for looping through arrays

0 = great pyrenes
1 = husky
2 = great dane
3 = saint bernard

Puts Output of FOREACH array loop above into a bulleted list

Arrays with Nested Foreach loops

000000
000033
000066
000099
0000cc
0000ff
003300
003333
003366
003399
0033cc
0033ff
006600
006633
006666
006699
0066cc
0066ff
009900
009933
009966
009999
0099cc
0099ff
00cc00
00cc33
00cc66
00cc99
00cccc
00ccff
00ff00
00ff33
00ff66
00ff99
00ffcc
00ffff
330000
330033
330066
330099
3300cc
3300ff
333300
333333
333366
333399
3333cc
3333ff
336600
336633
336666
336699
3366cc
3366ff
339900
339933
339966
339999
3399cc
3399ff
33cc00
33cc33
33cc66
33cc99
33cccc
33ccff
33ff00
33ff33
33ff66
33ff99
33ffcc
33ffff
660000
660033
660066
660099
6600cc
6600ff
663300
663333
663366
663399
6633cc
6633ff
666600
666633
666666
666699
6666cc
6666ff
669900
669933
669966
669999
6699cc
6699ff
66cc00
66cc33
66cc66
66cc99
66cccc
66ccff
66ff00
66ff33
66ff66
66ff99
66ffcc
66ffff
990000
990033
990066
990099
9900cc
9900ff
993300
993333
993366
993399
9933cc
9933ff
996600
996633
996666
996699
9966cc
9966ff
999900
999933
999966
999999
9999cc
9999ff
99cc00
99cc33
99cc66
99cc99
99cccc
99ccff
99ff00
99ff33
99ff66
99ff99
99ffcc
99ffff
cc0000
cc0033
cc0066
cc0099
cc00cc
cc00ff
cc3300
cc3333
cc3366
cc3399
cc33cc
cc33ff
cc6600
cc6633
cc6666
cc6699
cc66cc
cc66ff
cc9900
cc9933
cc9966
cc9999
cc99cc
cc99ff
cccc00
cccc33
cccc66
cccc99
cccccc
ccccff
ccff00
ccff33
ccff66
ccff99
ccffcc
ccffff
ff0000
ff0033
ff0066
ff0099
ff00cc
ff00ff
ff3300
ff3333
ff3366
ff3399
ff33cc
ff33ff
ff6600
ff6633
ff6666
ff6699
ff66cc
ff66ff
ff9900
ff9933
ff9966
ff9999
ff99cc
ff99ff
ffcc00
ffcc33
ffcc66
ffcc99
ffcccc
ffccff
ffff00
ffff33
ffff66
ffff99
ffffcc
ffffff

My Browser Safety Palette, from Arrays with Nested Foreach loops above... IN A TABLE

#000000#000033#000066#000099#0000cc#0000ff
#003300#003333#003366#003399#0033cc#0033ff
#006600#006633#006666#006699#0066cc#0066ff
#009900#009933#009966#009999#0099cc#0099ff
#00cc00#00cc33#00cc66#00cc99#00cccc#00ccff
#00ff00#00ff33#00ff66#00ff99#00ffcc#00ffff
#330000#330033#330066#330099#3300cc#3300ff
#333300#333333#333366#333399#3333cc#3333ff
#336600#336633#336666#336699#3366cc#3366ff
#339900#339933#339966#339999#3399cc#3399ff
#33cc00#33cc33#33cc66#33cc99#33cccc#33ccff
#33ff00#33ff33#33ff66#33ff99#33ffcc#33ffff
#660000#660033#660066#660099#6600cc#6600ff
#663300#663333#663366#663399#6633cc#6633ff
#666600#666633#666666#666699#6666cc#6666ff
#669900#669933#669966#669999#6699cc#6699ff
#66cc00#66cc33#66cc66#66cc99#66cccc#66ccff
#66ff00#66ff33#66ff66#66ff99#66ffcc#66ffff
#990000#990033#990066#990099#9900cc#9900ff
#993300#993333#993366#993399#9933cc#9933ff
#996600#996633#996666#996699#9966cc#9966ff
#999900#999933#999966#999999#9999cc#9999ff
#99cc00#99cc33#99cc66#99cc99#99cccc#99ccff
#99ff00#99ff33#99ff66#99ff99#99ffcc#99ffff
#cc0000#cc0033#cc0066#cc0099#cc00cc#cc00ff
#cc3300#cc3333#cc3366#cc3399#cc33cc#cc33ff
#cc6600#cc6633#cc6666#cc6699#cc66cc#cc66ff
#cc9900#cc9933#cc9966#cc9999#cc99cc#cc99ff
#cccc00#cccc33#cccc66#cccc99#cccccc#ccccff
#ccff00#ccff33#ccff66#ccff99#ccffcc#ccffff
#ff0000#ff0033#ff0066#ff0099#ff00cc#ff00ff
#ff3300#ff3333#ff3366#ff3399#ff33cc#ff33ff
#ff6600#ff6633#ff6666#ff6699#ff66cc#ff66ff
#ff9900#ff9933#ff9966#ff9999#ff99cc#ff99ff
#ffcc00#ffcc33#ffcc66#ffcc99#ffcccc#ffccff
#ffff00#ffff33#ffff66#ffff99#ffffcc#ffffff

Homework Assignment #6 Directions/Help

Create a php file that combines all the words in the array "php,mysql,dynamic" with all words on the list "bert, ernie, oscar" to produce a bulleted list of valid passwords.

This template should process two URL parameters named List1 and List2. (Hint: Use two arrays nested within each other to produce all possible combinations of passwords.)

URL for passing variable list:< a href="hw6.php?list1=php,mysql,dynamic&list2=bert, ernie,oscar">HW6

A problem was encountered with variables being passed as strings and not associative arrays. Using the explode() funtion was recommended as a fix. Documentation was provided by Professor available at: https://www.w3schools.com/php/func_string_explode.asp

I chose to solve the homework assignment, by first creating an array for List 1 and List 2 using a single element. Then I appended each array twice with the other required elements to create viable arrays, thus eliminating the comma-delimited problem encountered when using punctuation to separate elements in the lists.

Creating a Password Combination List from Two Separate Arrays and displaying it in a "Bulleted" List


Homework 6

My Password List

  • phpbert
  • phpernie
  • phposcar
  • mysqlbert
  • mysqlernie
  • mysqloscar
  • dynamicbert
  • dynamicernie
  • dynamicoscar