How can PHP be used to display and manipulate data from a text file with multiple entries separated by a delimiter?

To display and manipulate data from a text file with multiple entries separated by a delimiter in PHP, you can read the file line by line, explode each line using the delimiter, and then process the data as needed. You can store the extracted data in an array or perform operations directly on it.

<?php

// Open the text file for reading
$file = fopen('data.txt', 'r');

// Loop through each line in the file
while (!feof($file)) {
    $line = fgets($file);
    
    // Split the line into an array using the delimiter
    $data = explode(',', $line);
    
    // Process or display the data as needed
    echo 'Name: ' . $data[0] . ', Age: ' . $data[1] . '<br>';
}

// Close the file
fclose($file);

?>