651 Chapter 3 Exercise: PHP

  1. For PHP array:
    $color = array('blue', 'green', 'red'')

    Write a PHP script which will display the colors in an html page in the following way :

    Requirements:

    1. the first string is displayed as a heading.
    2. the 3 strings should be displayed with unordered list in front of them (see html docs).
    3. the 3 strings should be displayed using a foreach loop (see php docs).
    4. the strings are sorted (see php docs).
    5. the color of each array text matches the color (see css docs).
    6. Do not hard-code the html.
    7. Submit two urls: one for php link, another for txt file link of your php script source code.
  2. For PHP associative array:
    $salary=array( 'tom'=>1900, 'dick'=>2000, 'harry'=>1000);

    Write a PHP script which will display the colors in an html page in the following way :

    Requirements:

    1. display in an html table.
    2. the strings are sorted (see php docs for asort()).
    3. a conditional finds the highest salary and make the name cell red (see php docs for end()).
    4. Do not hard-code the html.
    5. Submit two urls: one for php link, another for txt file link of your php script source code.
  3. We want to see the http headers for a simple web page, such as http://userpages.umbc.edu/~jianwu/is651/programs/ch3/test.html, using curl -v -k command. Seperate the request and response message of the returned text into two text files. Save/Upload the text files on gl and submit two urls: one for each text file.