Well, I thought this idea looked like the cleanest way to do it. So, again, I copied it all and reproduced it exactly like you said, and still I get a third, empty variable randomly. I wonder if perhaps it's a problem where, when the file hits EOF, it's not seeing the EOF until it fgets another string, which picks up the EOF and then kills the loop? It seems reasonable, but I don't know how to fix it. The only workaround that has worked so far was the put the random data information in the included file in php formatting, so each line reads:
--- testdata.php ---
<? $string_array[] = "this is a sample"; ?>
<? $string_array[] = "this is another"; ?>
--- end output ---
That works. The reason I used php tags on ever line is so that when I use the form to submit new lines to the file, I don't have to work about killing the ?> tag at the end of the file, I can just setup my form to write the whole piece of php code and save myself hassle.
So, in closing, that solution works, but I really like your ideas better. If only I could kill that dead variable!