ereg_replace syntax question, thank you :)

ereg_replace syntax question, thank you :)

am 26.08.2007 03:49:10 von encepif

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.

Re: ereg_replace syntax question, thank you :)

am 26.08.2007 04:00:35 von Peter

>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 = '"';

Re: ereg_replace syntax question, thank you :)

am 26.08.2007 04:00:35 von Peter

>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 = '"';

Re: ereg_replace syntax question, thank you :)

am 26.08.2007 04:15:30 von luiheidsgoeroe

On Sun, 26 Aug 2007 03:49:10 +0200, 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

Re: ereg_replace syntax question, thank you :)

am 26.08.2007 04:15:30 von luiheidsgoeroe

On Sun, 26 Aug 2007 03:49:10 +0200, 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