Re: Stripping Single Quotes
| From: | Web master | Date: | Thu, 15 Mar 2001 20:37:20 +0000 |
| Subject: | Re: Stripping Single Quotes | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-44126@lists.php.net to get a copy of this message | ||
use the following code
$vals=explode("'", "'abc'");
$your_value=$vals[0]; //I am little confused, if it is not working try index1
Elan wrote:
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