Question: Write a PHP function called lineSum that accepts one integer and a filen ame as a parameter and returns the sum of the integers

Write a PHP function called lineSum that accepts one integer and a 

Write a PHP function called lineSum that accepts one integer and a filen ame as a parameter and returns the sum of the integers on that line number. For example, you may have a file named sums.txt that contains the following data 5 15 10 20 25 50 200 50 60 75 100 A call to lineSum("sums.txt", 2) returns 25, and a call to lineSum("sums.txt", 5) returns 200. Please also submit the html code you use to test the correctness of your function.

Step by Step Solution

3.51 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the PHP function lineSum that reads the file line by line and returns ... View full answer

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 Programming Questions!