note 9005 added to Strings
| From: | jacob at v-wave dot com | Date: | Tue, 10 Oct 2000 23:50:05 +0000 |
| Subject: | note 9005 added to Strings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6328@lists.php.net to get a copy of this message | ||
If you try to get text input from a form and then output it to a file you get a bunch of escape
characters flying around. Here's some code which I hope can effectively fix this:
function remSlash(&$targ, $source)
{
$i = 0;
$x = strlen($source);
while($i < $x)
{
if($source[$i] != "\\")
$targ .= $source[$i++];
else if(($targ[$i] == "\\") && ($source[$i+1] == "\\")){
$targ .= "\\";
$i+=2;
}
else
$i++;
}
}
I hope such a function doesn't already exist :P
http://www.php.net/manual/language.types.string.php