Issues in iterating the below php code [closed]

https://www.php.net/fgetcsv

You should open a file (with fopen function), then you can use the fgetcsv method to fetch a line from your csv as an array. Use a loop to iterate over every line.

    $file = fopen($fileName, "r");
    
    while ($row = fgetcsv($file, 1000, ' ')) {
        echo "<ul>";
        foreach ($row as $element) {
            echo "<li>$element</li>";
        }
        echo "</ul>";
    }
    
    fclose($file);

Read the CSV file into an array (like you're doing, but only once). Then loop through the array using foreach(). There is an example in the PHP documentation: https://www.php.net/manual/control-structures.foreach.php