note 34547 added to function.stripslashes
| From: | webmaster at dragondev dot com | Date: | Wed, 30 Jul 2003 15:12:46 +0000 |
| Subject: | note 34547 added to function.stripslashes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-53010@lists.php.net to get a copy of this message | ||
I was having trouble getting stripslashes to work in the right situation, so i made my own version
which works VERY well, it takes backslashes out of \" and \' of any string and can easily
be applied without changing the string contents, I also added a part at the end which makes html
returns (1 line breaks) out of \n but commented it out since this is the stripslashes function.
function unsuck(& $text)
{
if (strpos($text, "\'")){
do{
$text = str_replace("\'", "'", "$text");
}while(strpos($text, "\'"));
}else if (strpos($text, "\"")){
do{
$text = str_replace('\"', '"', "$text");
}while(strpos($text, '\"'));
}
//$text = str_replace('\n', '<BR>', "$text");
return($text);
}
----
Manual Page -- http://www.php.net/manual/en/function.stripslashes.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34547
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34547&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34547&report=yes