ereg_replace syntax question, thank you :)

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.
encepif [ So, 26 August 2007 03:49 ] [ ID #1805688 ]

Re: ereg_replace syntax question, thank you :)

>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 = '"';
Peter [ So, 26 August 2007 04:00 ] [ ID #1805689 ]

Re: ereg_replace syntax question, thank you :)

On Sun, 26 Aug 2007 03:49:10 +0200, <encepif [at] gmail.com> wrote:

> 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; )

Use the PCRE funtions if you can.

In this case, better yet:

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

No meed to use regular expressions for something like this.
--
Rik Wasmus
luiheidsgoeroe [ So, 26 August 2007 04:15 ] [ ID #1805691 ]

Re: ereg_replace syntax question, thank you :)

>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 = '"';
Peter [ So, 26 August 2007 04:00 ] [ ID #1805699 ]

Re: ereg_replace syntax question, thank you :)

On Sun, 26 Aug 2007 03:49:10 +0200, <encepif [at] gmail.com> wrote:

> 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; )

Use the PCRE funtions if you can.

In this case, better yet:

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

No meed to use regular expressions for something like this.
--
Rik Wasmus
luiheidsgoeroe [ So, 26 August 2007 04:15 ] [ ID #1805700 ]
PHP » alt.php » ereg_replace syntax question, thank you :)

Vorheriges Thema: <? print .. DIV> + InnerHTML question, thank you
Nächstes Thema: SELECT Syntax Question