What are the advantages and disadvantages of using a text file as a database in a website?

Using a text file as a database in a website can be advantageous for small projects with simple data storage needs, as it is easy to set up and does not require a database management system. However, text files can be slow and inefficient for large datasets, lack advanced querying capabilities, and may not provide adequate security for sensitive information.

// Example of reading data from a text file in PHP
$file = 'data.txt';
$data = file_get_contents($file);
echo $data;