How can the file() function be utilized in PHP to simplify the process of reading file contents into an array?
To simplify the process of reading file contents into an array in PHP, you can use the file() function. This function reads a file into an array where each element represents a line from the file. This can be useful when you need to process each line of a file individually or manipulate the file contents as an array.
$fileLines = file('example.txt');
foreach ($fileLines as $line) {
echo $line . "<br>";
}