First of all, the 'i' in the first argument of the 'for' comand is missing the '$'.
If you want to iterate through each value in the array, then you need to use '$posts[$i]' - as you have it.
An easier approach could be to use the foreach() function, and not bother with the counting or the for loop:
$posts = array_reverse(file('messages.txt'));
foreach ($posts as $someVariable)
{echo $someVariable;}
I hope that helps.