Stripping Single Quotes
| From: | Elan | Date: | Thu, 15 Mar 2001 20:15:47 +0000 |
| Subject: | Stripping Single Quotes | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-44112@lists.php.net to get a copy of this message | ||
Hi,
I have a string, "'abc'". How do I convert it to "abc" (i.e. how do I
strip the embedded single quotes) with a minimum of overhead?
(In case you'r wondering: I created the quoted string to store it in
MySQL, now I want to display the same string in a Webpage. Usually the
strings I display do not have embedded single quotes, and I add the
single quotes when I output the string printf("<input type='text'
value='%s'>", $value); That works well enough for strings that don't
already have embedded quotes. But when they do I want to get rid of them
quickly and easily, otherwise I get ...value = ''some value''> and
Netscape doesn't display the value embedded in two single quote
characters).
TIA,
Elan