The most likely reason is a php.ini configuration called magic_quotes. 
When enabled, PHP will automatically add slashes to single and double 
quotes, as well as slashes themselves (to escape them). This is helpful 
in some environments to help protect against attacks that can be used to 
execute arbitrary database commands. However, this particular setting is 
one of the more annoying ones, in my opinion, because it makes it more 
difficult to write portable code.

Hopefully this answers your question, and you can just check your 
php.ini. If you need to dynamically check the configuration, there is a 
function that will give you the setting of magic_quote. A quick 
reference in the manual will give it to you.

Oh, also, you cannot disable this per script, because the slashes are 
added perior to the data being given to PHP, hence prior to your 
script's execution.

Happy hacking.


Gerard Samuel wrote:

> A few months ago, I wrote a bit of code to stripslash() 
> "PATH_TRANSLATED" on a w2k box, because,
> php was reporting it with double slashes like C:\\winnt\\some_dir
> Today I noticed that the code is broken because PATH_TRANSLATED is now 
> reported with one slash like C:\winnt\some_dir
> Does anyone know when paths contain double slashes on a w2k box, so 
> that I can anticipate for them??
> Thanks for any insight you may provide.

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to