note 665 deleted from AddSlashes by ronabop
| From: | ronabop@php.net | Date: | Fri, 11 Aug 2000 17:12:22 +0000 |
| Subject: | note 665 deleted from AddSlashes by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-1314@lists.php.net to get a copy of this message | ||
Also this may seem like trivial advice...:<BR>
<BR>
It's really important where to use addslashes() !
<BR>
<BR>
$str = "c:trickybackslashespath";
echo addslashes($str);
<p>
...won't escape the t at the beginning, effectively outputting
<br>
c: ricky\backslashes\path
<br>
because you already assigned the string containing a TAB <I>before</I> using
addslashes...!<BR>
Correctly, the above should rather be
<br>
$str = addslashes("c:trickybackslashespath"); <br>
echo $str; <br>
<p>
An alternative to this would be the usage of single quotes. Read the comment in the main
string-functions section for more info on this.