Ok, first off.... the statement:
echo "fwrite($fcontents)[$i]";
is wrong in 2 ways. First, you can't echo the output from a function inside quotes. When you try to, PHP interprests it as a string instead of a function call. Second, you've mis-placed the closing bracket of the fwrite function. It should read:
fwrite($fcontents[$i]);
I don't understand why you're trying to echo the results of fwrite(). It returns boolean true or false, typically not something you echo to the screen. Exactly what are you trying to acheive with this code? Are you trying to write new headlines to a file, or print existing headlines to the screen?
-geoff