I have a bunch (several 10s of thousands...) text files to loop through. Each text file needs to undergo a series of PHP operations. I am looking for some sort of counter mechanism, showing where the operation is.
Sounds easy enough: I can make a $counter variable, and increment it by 1 when the next file is opened, etc. I have made something with ob_flush() before opening and flush() after closing a text file. This shows a continuing row of $counter contents, something like “17 18 19 20 21” etc.
That looks rather clumsy, though, considering that I’m talking about thousands of files and hence thousands of counter positions. So, I am looking for a way to display the $counter at a Fixed Position on the screen...
In pseudo-code:
<code>
$my_text_collection = $array_with_filenames;
$counter = 1;
while (not at the end of $array_with_filenames) {
echo_at_a_fixed_placed($counter);
$x = open_up($array_with_filenames[$counter]
$y = do_some_stuff_to($x);
$z = get_rid_of($x)
$counter++;
}
</code>
The tough part is the “echo_at_a_fixed_place” thingy... There are tons of Javascript counters out there, time- or cookie- or file-based, but they appear very cumbersome to work with. And I’m afraid using Javascript will prove inevitable, because I want to echo something While PHP is doing is processing, which is not what PHP likes to do. Unfortunately, Javascript is a completely unknown world for me.
So, my hope is to find someone out here who could help me out with this “echo_at_a_fixed_place” problem, preferably with a working example...