Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NOTE: PUT THE PRINTING OF THE TABLE IN A FUNCTION!!! Then call the function as many times as necessary to complete the tasks below. Declare

NOTE: PUT THE PRINTING OF THE TABLE IN A FUNCTION!!! Then call the function as many times as necessary to complete the tasks below.

Declare a one dimensional associative array that has at least 8 key/element pairs.

Print out the array in a table (use html

as you did in Lab 1).

Print out the sorted array in table form.

unset the second element in the sorted array (use the unset function, look it up on php.net)

Print out the reverse sorted array in table form.

Print out the array sorted by KEY value in table form.

Part II

Create a two dimensional array (HINT: the second dimension should be associative, with keys tweets, folllowers, following. These refer to the number of tweets the user tweeted, how many followers the user has and how many other users this user is following!. The first dimension can be indexed, and you can add Username to the second dimension, or you can have both dimensions be associative, where the Username points to the first person etc.) that contains the following information about twitter users:

Handle (Username)

Tweets

Number of Followers

Following

joeDoe

20000

45

8

JohnD

62000

123

160

computerSavy

75

1

25

myTwitterAccount

1800

15

6

Print out the array sorted by tweets (ascending)

Print out the array sorted by followers (ascending)

Print out only users who have followers > 10, sorted by followers in descending order.

Add a form to your php file that has a user put in a Username with the method post. If the name exists in the array, do nothing. If the name does not, add an element to the array with the Username and all other values set to 0. Print out the new array.

EXTRA CREDIT: The way the assignment is set up above, you can add one person but the array otherwise stays the same. If you then post again, it will start off with the old original array. For extra credit, use a hidden element in the form that allows a user to keep adding new users. See: http://www.pontikis.net/tip/?id=11

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions