The following php code:
<?php
$fopen = fopen("tasklistout.csv","r");
while(!feof($fopen))
{
    $line = fgets($fopen);
    echo "\r\n\t<tr>";
    $piece_array = preg_split("/[\s,]+/",$line);
    for ($forvar = 1; $forvar <= 5; $forvar++)
    {
        $array_index = $forvar - 1;
        echo "\r\n\t\t<td>" . $piece_array[$array_index] . "</td>";
    }
    echo "\r\n\t</tr>\r\n";
}
fclose($fopen);
?>
Produces the following error: (on 4 separate occasions)
Notice: Undefined offset: 1 in file.php on line 33
In the following HTML Document:
<!doctype html>
<html lang="en">
   <head>
     <meta charset="utf-8">
     <title>Lab_11-Objective_01--Tables</title>
     <meta name="description" content="HTML 'table' element usage for Lab 11 Objective 01">
     <meta name="author" content="Charles E Lentz">
     <link rel="stylesheet" href="stylesheet.css">
   </head>
   <body>
   <table>
    <tr>
        <th>Image Name</th>
        <th>PID</th>
        <th>Session Name</th>
        <th>Session#</th>
        <th>Mem Usage</th>
    </tr>
    <?php
    $fopen = fopen("tasklistout.csv","r");
    while(!feof($fopen))
    {
        $line = fgets($fopen);
        echo "\r\n\t<tr>";
        $piece_array = preg_split("/[\s,]+/",$line);
        for ($forvar = 1; $forvar <= 5; $forvar++)
        {
            $array_index = $forvar - 1;
            echo "\r\n\t\t<td>" . $piece_array[$array_index] . "</td>";
        }
        echo "\r\n\t</tr>\r\n";
    }
    fclose($fopen);
    ?>
   </table>
   </body>
</html>
How do I fix this error?
 
     
     
     
    