What PHP function can be used to load data from a file into an array?
To load data from a file into an array in PHP, you can use the `file()` function. This function reads a file into an array where each element of the array represents a line of the file. This makes it easy to access and manipulate the data within the file.
// Load data from a file into an array
$dataArray = file('data.txt');
// Loop through the array and display each line
foreach ($dataArray as $line) {
echo $line . "<br>";
}
Related questions
-
PHP JOIN statements naming conventions
-
CSV files Excel compatibility PHP functions
-
regex patterns optimization text formatting