I done more searching on google... I came across this which, i understand a bit more than the above.
<?php
$total = 0;
$fin = @fopen("num.txt", "r");
if ($fin) {
while (!feof($fin)) {
$buffer = fgets($fin);
if (preg_match('/got a break of "(\d+)"/',$buffer,$matched))
$total += $matched['1'];
else
continue;
}
fclose($fin);
print $total;
}
I guess that would show the total amount ??? , if it works. I am currently at work, so unable to test it. If i can get that to show the total of all the numbers after 'got a break of' then i can easily re write it to calculate average.
Would the above be a better method for a newbie to use?