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

ereg_replace syntax question, thank you :)

P: n/a
I think this is the right command., could someone please show me how
to replace instances of a quote like this " with its html version -
". I am mixed up with the escaping, etc. Thank you :-)

ereg_replace( " " ," '",$fixedstring; )

I appreciate any help.

Aug 26 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
>I think this is the right command., could someone please show me how
to replace instances of a quote like this " with its html version -
". I am mixed up with the escaping, etc. Thank you :-)

ereg_replace( " " ," '",$fixedstring; )
This really depends upon the reason you wish to replace the double quote. If
it is definately only " you wish to change to its html equivalent you can do
:-

echo ereg_replace( '"' ,""",$string);

If you wish to change all html chars you can use:-

echo htmlspecialchars($string);

in both cases I have string as:-

$string = '"';
Aug 26 '07 #2

P: n/a
Rik
On Sun, 26 Aug 2007 03:49:10 +0200, <en*****@gmail.comwrote:
I think this is the right command., could someone please show me how
to replace instances of a quote like this " with its html version -
&quot;. I am mixed up with the escaping, etc. Thank you :-)

ereg_replace( " " ," '",$fixedstring; )
Use the PCRE funtions if you can.

In this case, better yet:

str_replace('"','&quot;',$string);

No meed to use regular expressions for something like this.
--
Rik Wasmus
Aug 26 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.