I'd like to pull values from textfiles in a directory and put these lists of values into arrays.
I am not sure however how to arrange these arrays into a mysql result set "like" object.
Here is what I have so far:
// Retrieve all files names, create an array
$dir = './textfiles/';
$files1 = glob($dir . '*' . '.txt');
foreach ($files1 as $filename)
{
$file_array[] = basename($filename);
}
//use the file function to create arrays from the text files
$filepath = $dir . $file_array[0];
$text_array = file($filepath);
The code above only retrieves the information from 1 text file. How can I retrieve the other values into additional arrays?
Secondly once all the arrays are retrieved, how can a make the object?
Thirdly, how can I make this a function to accomodate newly created textfiles?