By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,179 Members | 2,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,179 IT Pros & Developers. It's quick & easy.

please help in preg_replace quotes...

P: n/a
well, I have this peace of code which isn't woking as I would like it to
work.

$tekst = preg_replace('/\\\"/', '"', $tekst);

In my forms, I would like to change " to " but this line is actualy
"stripnig" text that it looks (or "cames to mysql db) like:

Lorem ipsum \"

instead of

Lorem ipsum "dolor sit amet",

anyone can help me?

--
fotozine.org
"zicani okidac"
--
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mon, 14 Mar 2005 17:40:17 +0100, Fotozine wrote:
$tekst = preg_replace('/\\\"/', '"', $tekst);


This code

$t = 'Example "text"';
echo htmlspecialchars( preg_replace( '/"/', '"', $t ) )."\n";
echo htmlspecialchars( preg_replace( '/\"/', '"', $t ) )."\n";
echo htmlspecialchars( preg_replace( '/\\"/', '"', $t ) )."\n";
echo htmlspecialchars( preg_replace( '/\\\"/', '"', $t ) )."\n";

gives

Example "text"
Example "text"
Example "text"
Example "text"
--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Jul 17 '05 #2

P: n/a
f .oO(Fotozine)
well, I have this peace of code which isn't woking as I would like it to
work.

$tekst = preg_replace('/\\\"/', '"', $tekst);

In my forms, I would like to change " to " [...]


$tekst = preg_replace('/"/', '"', $tekst);
$tekst = strtr($tekst, array('"' => '"'));
$tekst = str_replace('"', '"', $tekst);
$tekst = htmlspecialchars($tekst);
....

Micha
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.