On Saturday 13 June 2009, Al wrote:
> I may not have been very clear. Feed it just      "test"   with the
> quotes. You should get back, "test" the same as you gave it.   Instead,
> I get back &quote;test&quote;

Like Shawn, I have tried your code in isolation and only get the expected 
results. I looped it over a few test values:

$valueList = array('"','"test"','"test&test"','"test&amp;test"');
echo "<pre>\n\n";
foreach ($valueList as $value) {
        echo "Before: $value\n";
        $value=preg_replace("%&(?!amp;)%i", "&amp;", $value);
        echo "After: $value\n\n";
echo '</pre>';

outputs (ignoring <pre> as that was just to remove the <br /> for easy 

Before: "
After: "

Before: "test"
After: "test"

Before: "test&test"
After: "test&amp;test"

Before: "test&amp;test"
After: "test&amp;test"

The only conclusion is that something else in your code is converting the 
quotes. Have a look around.



PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to