I've looked for questions on this topic, but failed to get what I'm looking for. This is for C++, I need similar for PHP. This is for including php files, I just want to read a CSV file.
I have this:
if(file_exists("data.csv")){ echo "CSV file found"; $csv_data = file_get_contents("data.csv"); $lines = explode("\n", trim($csv_data)); $array = array(); foreach ($lines as $line){ $array[] = str_getcsv($line); }else {echo "File not found";} But I want to NOT specify the file name - i.e. generically load/read/open the file.
Is there any simple why of doing that? Doesn't make sense, but I was told to not have anything hard coded in my PHP script.
Thanks in advance.
"data.csv"with a variable?