RE: [PHP] String Functions (replace)
| From: | Brooks, Ken | Date: | Sun, 25 Mar 2001 15:47:30 +0000 |
| Subject: | RE: [PHP] String Functions (replace) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-45491@lists.php.net to get a copy of this message | ||
Nevermind, stumbled across addslashes().
What a wonderful language. :)
-ken
-----Original Message-----
From: Brooks, Ken [mailto:KBrooks@netEPS.com]
Sent: Sunday, March 25, 2001 10:45 AM
To: php-general@lists.php.net
Subject: [PHP] String Functions (replace)
I know this is completely stupid but how can i take something with a single
quote ' and replace it in the string with \'
Ex:
Bain's Deli
to
Bain\'s Deli
$fieldcontents = strtr($fieldcontents, "'", "\\\'"); -or-
$fieldcontents = strtr($fieldcontents, "'", "\\'");
doesn't work. I feel dumb, but my brain isn't going yet this morning.
Thanks,
ken
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net