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 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
Here is the PHP function lineSum that reads the file line by line and returns ... View full answer
Get step-by-step solutions from verified subject matter experts
