Hi all
I want to parse a CSV file and get the last few items (which are monthly totals), into variables.
The CSV length will change but the last 14 items are always the same - the word "Totals", 12 values, then the word "End of Report".
"Totals",2000.00,0.00,480.00,480.00,480.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,"End of Report"
From the above example I'd like to get:
$month1 = 2000.00
$month2 = 0.00
$month3 = 480.00
etc
I don't know how to parse the file then start from the end and work backwards!
Would it be best to re-order the CSV then take items 2 - 13? (and if so... how do I do that!)
I also can't look for the word "Totals" and start from there because it exists more than once in the CSV.
Can anyone suggest a way of doing this?
Many thanks
Simon