note 90634 rejected from function.str-getcsv by danbrown
| From: | danbrown@php.net | Date: | Fri, 01 May 2009 18:46:58 +0000 |
| Subject: | note 90634 rejected from function.str-getcsv by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154082@lists.php.net to get a copy of this message | ||
Note Submitter: php at goepp dot com
----
Has anyone gotten escape character to work on this function or the fgetcsv? It defaults to \ and I
have tried explicitly setting it too.
dang@ubuntu:~/cdr$ php -version
PHP 5.3.0RC1 (cli) (built: May 1 2009 10:08:08)
My code:
<?php
$string = "parse,this,string\\ with\\ spaces,and\\,commas,but it doesn\\'t
work";
echo $string . "\n";
$return_array = str_getcsv ($string);
print_r($return_array);
?>
Which results in:
dang@ubuntu:~/cdr$ php str_csv_test.php
parse,this,string\ with\ spaces,and\,commas,but it doesn\'t work
Array
(
[0] => parse
[1] => this
[2] => string\ with\ spaces
[3] => and\
[4] => commas
[5] => but it doesn\'t work
)
Any ideas?