note 34293 modified in function.fgetcsv by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 18:22:26 +0000 |
| Subject: | note 34293 modified in function.fgetcsv by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155105@lists.php.net to get a copy of this message | ||
You should pay attention to the fact that "fgetcsv" does remove leading TAB-chars
"chr(9)" while reading the file.
This means if you have a chr(9) as the first char in the file and you use fgetcsv this char is
automaticaly deleted.
Example:
file content:
chr(9)first#second#third#fourth
source:
<?php $line = fgetcsv($handle,500,"#"); ?>
The array $line looks like:
$line[0] = first
$line[1] = second
$line[2] = third
$line[3] = fourth
and not
$line[0] = chr(9)first
$line[1] = second
$line[2] = third
$line[3] = fourth
All chr(9) after another char is not deleted!
Example:
file content:
Achr(9)first#second#third#fourth
source:
<?php $line = fgetcsv($handle,500,"#"); ?>
The array $line looks like:
$line[0] = Achr(9)first
$line[1] = second
$line[2] = third
$line[3] = fourth
--was--
You should pay attention to the fact that "fgetcsv" does remove leading TAB-chars
"chr(9)" while reading the file.
This means if you have a chr(9) as the first char in the file and you use fgetcsv this char is
automaticaly deleted.
Example:
file content:
chr(9)first#second#third#fourth
source:
$line = fgetcsv($handle,500,"#");
The array $line looks like:
$line[0] = first
$line[1] = second
$line[2] = third
$line[3] = fourth
and not
$line[0] = chr(9)first
$line[1] = second
$line[2] = third
$line[3] = fourth
All chr(9) after another char is not deleted!
Example:
file content:
Achr(9)first#second#third#fourth
source:
$line = fgetcsv($handle,500,"#");
The array $line looks like:
$line[0] = Achr(9)first
$line[1] = second
$line[2] = third
$line[3] = fourth
http://php.net/manual/en/function.fgetcsv.php