Now I am doing a simple thing, I will read from a CSV file, this column A contains code such as "EN", column B contains the specific name "English", etc., and I want to read them into an associated array.
My current action looks like this:
$handle = fopen("Languages.csv","r") or die("EPIC FAIL!");
$languageArray = array(
while (($row = fgetcsv($handle, 1000, ",")) !== FALSE)
{
$row[0] => $row[1],
}
)
But he really complains about my syntax, so I'm just wondering if there is a way to initialize my associated array by getting all the lines of my csv file and putting the first row (from column A) as the key, the second row (from column B) as the value ?
Thank.
Kevin source
share