note 7693 deleted from AddSlashes by jeroen
| From: | jeroen@php.net | Date: | Fri, 10 Aug 2001 19:40:40 +0000 |
| Subject: | note 7693 deleted from AddSlashes by jeroen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16557@lists.php.net to get a copy of this message | ||
Also this may seem like trivial advice...:
It's really important where to use addslashes() !
$str = "c:trickybackslashespath";
echo addslashes($str);
...won't escape the t at the beginning, effectively outputting
c: rickybackslashespath
because you already assigned the string containing a TAB _before_ using addslashes...!
Correctly, the above should rather be
$str = addslashes("c:trickybackslashespath");
echo $str;
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.