On Sunday, November 23, 2003, at 10:50 PM, tony wrote:

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 '|'.

You can do this with http://www.php.net/fgetcsv


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

In this case, 'string delimiter' would be set to '|' rather than the default ','.

There's some examples at the above URL.



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....

This can all be achieved taking the above example and bending it to suit your needs.



Justin French


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



Reply via email to