Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PHP The file classList.txt should be copied into the www directory. Use the file() function to read in this file as an array of string,

PHP

The file classList.txt should be copied into the www directory. Use the file() function to read in this file as an array of string, each string containing a line of the file. Note that the strings in the array will still have the newline at the end. If you want to remove the , use the trim() function. To determine if EECS is in the line, use the explode() func to break the string into an array containing the students name, email, degree studied (EECS, MATH, or BIZ), and year. Use the in_array() function to determine if EECS is present in the array. If it is found in the array, then use the highlight class defined in the CSS to make the text in this paragraph highlighted.

PHP Arrays, Strings, and File

ini_set('display_errors', 1); # only need to call these functions error_reporting(E_ALL); # one time ?>

Lab 4

by john


Task 1: While loop

Simulate multiple dice rolls until a 6 is reached. Print out the results of each roll.

"); }

?>

Task 2: Array, for-loop, string function

Create an array of strings that is made up of 10 words with the first letter capitalized. Your strings can be of any words you want. Print out these words in a table, where the first column is the word in the array and the second column are the same words in all uppercase. You should use a the rows of the table.

'); foreach($list as $item) { $upper = strtoupper($item); print("$item$upper"); } ?>

Task 3: Files, arrays, and for-loops

This task is to read in the contents of the file classList.txt in to PHP. Then, you should print out each line from the file as a paragraph element. If the line contains the string "EECS", print this out using highlight. See the CSS file for the class name for highlight (you can also view the source of this document to see example of the HTML output).

?>

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

Students also viewed these Databases questions

Question

Complexity of linear search is O ( n ) . Your answer: True False

Answered: 1 week ago