note 90634 added to function.str-getcsv
| From: | php at goepp dot com | Date: | Fri, 01 May 2009 18:44:20 +0000 |
| Subject: | note 90634 added to function.str-getcsv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-154081@lists.php.net to get a copy of this message | ||
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?
----
Server IP: 209.41.74.194
Probable Submitter: 98.234.189.28
----
Manual Page -- http://www.php.net/manual/en/function.str-getcsv.php
Edit -- https://master.php.net/note/edit/90634
Del: integrated -- https://master.php.net/note/delete/90634/integrated
Del: useless -- https://master.php.net/note/delete/90634/useless
Del: bad code -- https://master.php.net/note/delete/90634/bad+code
Del: spam -- https://master.php.net/note/delete/90634/spam
Del: non-english -- https://master.php.net/note/delete/90634/non-english
Del: in docs -- https://master.php.net/note/delete/90634/in+docs
Del: other reasons-- https://master.php.net/note/delete/90634
Reject -- https://master.php.net/note/reject/90634
Search -- https://master.php.net/manage/user-notes.php