Question: PHP Look at PHP examples 04 JSON.php and 04a JSON.php and 05 JSON.php to see how to create a JSON string and processs it in

 PHP Look at PHP examples 04 JSON.php and 04a JSON.php and

PHP Look at PHP examples 04 JSON.php and 04a JSON.php and 05 JSON.php to see how to create a JSON string and processs it in a PHP program. Create a PHP program that does this: 1. Create a JSON string with an array of 5 records ("tuples"). Each record: Is surrounded in { } Has these 5 values Is comma separated from records before and after it The array is surrounded by [ ] 2. Each of the 5 records will have values for these 5 categories of data (you make up the data): first name, last name, age, state, salary 2 values will be numbers, the others are strings. 3. Display the JSON string. 4. Save the JSON string to a file named "HOMEWORK 2. json" 5. Display "HOMEWORK 2 SAVED" as a header 2 6. Calculate and display the average salary. TIP: Decode the string to an associative array and use foreach or for to process all records. Recall you computed average in JavaScript. Compute the total of all salary and divide by number of records. 7. Save your work in a file named lastName-HOMEWORK 2.php lastName must be your last name exactly as it is in BONGO. PHP WILL PRODUCE WHAT LOOKS LIKE THIS - YOUR DATA WILL BE DIFFERENT [{"firstname":"Bob","lastname":"Smith","age":21,"state":"Kentucky", "salary":95000},{"firstname":"Rupert", "lastname":"Sanders","age":21,"state":"Indiana", "salary":105000), {"firstname":"Samuel", "lastname":"Reeds", "age":24,"state":"Pennsylvania", "salary":65000},{"firstname":"Rudy", "lastname":"Smith", "age":2,"state":"Florida", "salary":75000), {"firstname":"Wanda", "lastname":"Jones", "age":19,"state":"New York", "salary":88000}]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!