fgets()` function. The `fgets()` function reads a single line from the file and returns it as a string. Here's an example program that demonstrates how to use the `fgets()` function :<?php
$file = fopen("example.txt", "r") or die("Unable to open file!"); // open the file in read mode
$line = fgets($file); // read a single line from the file
echo $line; // display the line
fclose($file); // close the file
?>example.txt" in read mode using the `fopen()` function. Then we read a single line from the file using the `fgets()` function and stored it in the variable `$line`. echo` statement and closed the file using the `fclose()` function.