Question: How would I write a foreach loop that starts at a specific point and goes until it reaches the end of the file? More details:
How would I write a foreach loop that starts at a specific point and goes until it reaches the end of the file?
More details: I am working on a program that takes form input and saves it into a text file. I then display the submitted data in a table format (don't ask, it's a homework requirement) and can allow for updates. Each update is then appened to the end of the text file. I'm having trouble figuing out how to display this.
///////Here is the foreach loop I want to use to display the updates. I know the updates would start at index 8, but there's no max limit so I'm not sure how to replicate the array.length function in this format. ////////
//display updates, if any foreach (array_slice($BugReports, 8) as $FileName) { if (($FileName != ".") && ($FileName != "..")) { $Report = file($Dir . "/" . $FileName); echo '
Update
'; } }
///////Here is all of the php code for the page. I've included an image of the output since you won't be able to replicate it all on your end (There's three other php files tied into all this). ////////
Bug Reports Update
//display updated report $Dir = "submissions"; if (is_dir($Dir)) { $BugReports = scandir($Dir); echo "
Bug Description | '; echo ''.htmlentities($Report[0]).' | '; echo '
Product Name | '; echo ''.htmlentities($Report[1]).' | '; echo '
Product Version | '; echo ''.htmlentities($Report[2]).' | '; echo '
Type of Hardware | '; echo ''.htmlentities($Report[3]).' | '; echo '
Operating System | '; echo ''.htmlentities($Report[4]).' | '; echo '
Frequency of Occurrence | '; echo ''.htmlentities($Report[5]).' | '; echo '
Proposed Solution | '; echo ''.htmlentities($Report[6]).' | '; echo '
Update | '; echo ''.htmlentities($Report[8]).' | '; echo '
'; echo '
Return to bug list, OR add another update.
'; echo "
"; }
?>

Bug Reports Update Bug Description Product Name Product Version Type of Hardware Operating System Frequency of Occurrence Proposed Solution Return to bug list, OR add another update
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
