Page 1 of 1

how to assign csv data into three different variables

Posted: Tue May 06, 2008 7:05 am
by prashantAG
i have csv file contains username,firstname, and emails.
i want assign three variables from csv file seperately what i will do for that

this is code:
$fcontents = file('C:\Documents and Settings\winfo2\Desktop\user.csv');
# expects the csv file to be in the same dir as this script

for($i=1; $i<sizeof($fcontents); $i++) {
$line = trim($fcontents[$i]);

$arr = explode("\t", $line);

print_r( $arr);

Re: how to assign csv data into three different variables

Posted: Tue May 06, 2008 10:27 am
by Kieran Huggins