note 7694 deleted from AddSlashes by ronabop
| From: | ronabop@php.net | Date: | Fri, 11 Aug 2000 17:20:39 +0000 |
| Subject: | note 7694 deleted from AddSlashes by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-1318@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.