Re: Bug #27730 (fgetcsv() fails on 2 newlines)
| From: | Ilia Alshanetsky | Date: | Fri, 02 Apr 2004 14:17:42 +0000 |
| Subject: | Re: Bug #27730 (fgetcsv() fails on 2 newlines) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8893@lists.php.net to get a copy of this message | ||
I've just tried the script an both PHP 4.3.6, 4.2.3 and 5.0 return the same
results.
<?php
$fp = fopen("test.csv", 'w' );
fwrite( $fp, "one;val1\ntwo;val2\n\nthree;val3\n" );
fclose( $fp );
$fp = fopen("test.csv", 'r' );
$items = array( );
while( $d = fgetcsv( $fp, 4096, ';' ) ) {
var_dump($d);
}
fclose( $fp );
?>
Result:
array(2) {
[0]=>
string(3) "one"
[1]=>
string(4) "val1"
}
array(2) {
[0]=>
string(3) "two"
[1]=>
string(4) "val2"
}
array(1) {
[0]=>
string(0) ""
}
array(2) {
[0]=>
string(5) "three"
[1]=>
string(4) "val3"
}
Ilia