note 9873 added to str_replace

From: Date: Tue, 28 Nov 2000 21:38:38 +0000
Subject: note 9873 added to str_replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-8205@lists.php.net to get a copy of this message
It seems that PHP4 escapes single quotes in incoming strings for you for easy insertion into sql databases. Pretty neat feature unless you're upgrading from PHP3. To get it to work in both versions, escape twice like this: $text = str_replace ("\\", "", $text); $text = str_replace ("'", "\'", $text); http://www.php.net/manual/function.str-replace.php

« previous php.notes (#8205) next »