note 23548 deleted from function.addslashes by philip
| From: | philip@php.net | Date: | Tue, 15 Oct 2002 04:13:58 +0000 |
| Subject: | note 23548 deleted from function.addslashes by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-38086@lists.php.net to get a copy of this message | ||
I always had the problem of never knowing when slashes had already been added. I only needed them to
be added once, and did not want to add them a second time. Here's a little function that will
make sure your string will only be escaped once:
function formatSlashes($string){
while(strstr($string,"\\")){
$string=stripslashes($string);
}
return addslashes($string);
}