Msg#: 4461238 posted 2:43 pm on Jun 4, 2012 (gmt 0)
I need a PHP script to extract a number of lines from a text file, and insert them into an array.
The lines that I need to extract all have the following in common: - the line preceding it has a line of dashes, preceded by 4 spaces ; - the line after it is blank, and then is followed by another line of dashes (with no preceding spaces).
Like this: ---------------------- Total : 26.225 %
Msg#: 4461238 posted 2:02 pm on Jun 12, 2012 (gmt 0)
Regular expressions are likely going to be involved in the solution. You create a pattern and you can capture all the matches in an array. See preg_match() and preg_match_all() in the online PHP manual pages.