note 10713 deleted from function.str-replace by philip

From: Date: Mon, 04 Feb 2002 12:45:33 +0000
Subject: note 10713 deleted from function.str-replace by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-26211@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>

« previous php.notes (#26211) next »