array fgetcsv ( resource handle, int length [, string delimiter [, string
enclosure]])

PHP manual extract:
<?php
$row = 1;
$handle = fopen ("test.csv","r");
while ($data = fgetcsv ($handle, 1000, ",")) {
    $num = count ($data);
    print "<p> $num fields in line $row: <br>\n";
    $row++;
    for ($c=0; $c < $num; $c++) {
        print $data[$c] . "<br>\n";
    }
}
fclose ($handle);
?>Lucian"Tony" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I'm new to php I just come from perl, and I wanted to know like perl if we
> can open a file and read delimited line just like the cvs function, but I
> don't want comma separated, i want the vertical bar '|'.
> also if we read that file can the 'column' go in an array like perl
> i.e if we have a record
> Name|Phone|address|age|email
> can we put it into an array like
> $record[]
> and say
> $record[0] is Name, $record[1] is Phone etc....
>
> Any help is well appreciated.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to