Re: &amp

From: Date: Wed, 28 Jan 2004 15:23:19 +0000
Subject: Re: &amp
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-176059@lists.php.net to get a copy of this message
Gerard Samuel wrote:
On Wednesday 28 January 2004 09:32 am, Stuart wrote:
Diana Castillo wrote:
is there any function that will always replace a "&" with a "&amp" in a string?
$string = str_replace('&', ' ', $string);
Just a heads up on using the above method. If there are more than one & in the string it will produce unexpected results. For example "Here is one & and here is another &" will produce "Here is one & and here is another &"
Not from where I'm sitting [PHP 4.3.3RC1 (cli) (built: Jun 21 2003 23:40:27) on FreeBSD built from ports]. Code... print str_replace('&', '&', 'Here is one & and here is another &'); ... outputs ... Here is one & and here is another & Do you need more coffee? -- Stuart

« previous php.general (#176059) next »