ITSE 1306

Looping Assignment 5

A. Use a for() loop in PHP to create the following HTML output:

This is line 1
This is line 2
This is line 3
This is line 4
This is line 5

B. Use a while() loop in PHP to create the following HTML output:

This is row 1
This is row 2
This is row 3
This is row 4
This is row 5

C. Use a do while() loop in PHP to create the following HTML output:

This is row 1
This is row 2
This is row 3
This is row 4
This is row 5

D. Use a for() loop and a while loop in PHP to create the following HTML output:

12345
12345
12345
12345
12345

E. Use 2 while() loops in PHP to create the following HTML output:

row 1 column 1row 1 column 2row 1 column 3row 1 column 4row 1 column 5
row 2 column 1row 2 column 2row 2 column 3row 2 column 4row 2 column 5
row 3 column 1row 3 column 2row 3 column 3row 3 column 4row 3 column 5
row 4 column 1row 4 column 2row 4 column 3row 4 column 4row 4 column 5
row 5 column 1row 5 column 2row 5 column 3row 5 column 4row 5 column 5

F. Use 2 for() loops in PHP to create the following HTML output:

row 1 column 1row 1 column 2row 1 column 3row 1 column 4row 1 column 5
row 2 column 1row 2 column 2row 2 column 3row 2 column 4row 2 column 5
row 3 column 1row 3 column 2row 3 column 3row 3 column 4row 3 column 5
row 4 column 1row 4 column 2row 4 column 3row 4 column 4row 4 column 5
row 5 column 1row 5 column 2row 5 column 3row 5 column 4row 5 column 5
row 6 column 1row 6 column 2row 6 column 3row 6 column 4row 6 column 5
row 7 column 1row 7 column 2row 7 column 3row 7 column 4row 7 column 5
row 8 column 1row 8 column 2row 8 column 3row 8 column 4row 8 column 5
row 9 column 1row 9 column 2row 9 column 3row 9 column 4row 9 column 5
row 10 column 1row 10 column 2row 10 column 3row 10 column 4row 10 column 5

G. Use a for() loop to print out the contents of an array named $answers in a table row.
yesnoundecidedmaybeI do not knowanyways


H. Use a foreach() loop to print out the contents of an array named $animals in a form select list.

Back To Index