note 7693 added to AddSlashes
| From: | Manuel at Hossfeld dot de | Date: | Fri, 11 Aug 2000 17:19:32 +0000 |
| Subject: | note 7693 added to AddSlashes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-1316@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: ricky\backslashes\path
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.
http://www.php.net/manual/function.addslashes.php