note 10713 modified in str_replace by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Wed, 14 Feb 2001 01:56:02 +0000 |
| Subject: | note 10713 modified in str_replace by jmcastagnetto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11022@lists.php.net to get a copy of this message | ||
[Editor's note: The code below does exactly was is being asked, it is replacing the each double
quote char by the corresponding array value in the string that contains
2 double quotes. Hence the output would be correct. I think the original poster might be confused]
<pre>
PHP has a bug in it, when you
do:
while (list ($key, $val) = each ($array)) {
$val = str_replac('"',$val,'""');
$output .= "\"$val\"" . ",";
}
If the array is 1,2,3, the output should be 1,2,3 because each array element contains no double
quotes.. But the output contains 11,22,33 ..
Sounds like a special case of your string object that your string handling functions don't
handle..
</pre>
http://www.php.net/manual/str-replace.php