Re: Stripping Single Quotes

From: Date: Thu, 15 Mar 2001 20:30:23 +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-44121@lists.php.net to get a copy of this message
In article <3AB122F3.1F28CA27@techscribe.com>, rebol@techscribe.com (Elan) wrote: > 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? If there's no chance that the string could also contain legit single-quotes (such as as an apoostrophe), you can simply use str_replace(). Otherwise, either str_replace() with strpos() -- to search/replace only on 2nd char and 2nd-to-last character -- or good ol' preg_replace() by itself. -- CC

« previous php.general (#44121) next »