I need to make a blog using a TXT file for a school project. In the text file $blog [0] is the title of the message, $blog1 is the username and $blog[2] is the message itself.
    $file = fopen('blogs.txt', 'r');
    while(!feof($file)) {
        $blog = fgets($file);
        $blog = explode("*", $blog);
        echo "
        <p><strong>". $blog[0]. "</strong>
        <br>By: ". $blog[1]. 
        "<br>". $blog[2];
    }
The page shows all the messages. But at the bottom I have a couple of 'Undefined Offsets: 1' and 'Undefined offset: 2's. It also says 'By: ' (as shown in the echo) a couple of times.
 
    