I have lots of php coded files in my drupal site that I integrate with the theme. But when I attempt to use the backslash (as an escape character) and save, it gets omitted automatically. This is an example.
If ($n=="\n") do_stuff();
Then if I save the file, and open it again, I find this:
if ($n=="n") do_stuff();
which is quite frustrating because the script has lots of control characters (I know I could use PHP_EOL, but I use others) and I use the backslash a lot in the code. An alternative that I found to work is to use the chr() function, so something like this would work:
If ($n==chr(92)."n") do_stuff();
I would like to know if there is a way to overcome this problem (perhaps an option somewhere). I may attempt to do a hack and dig down in the system but I fear that this omission is for a reason and I don't want to screw things up.
Your help is appreciated.
Will
Comments
Not a PHP problem
PHP doesn't change the content of PHP files -- in fact, if your server is properly configured, the Web application should NEVER have write access to PHP files. I'd look at your text editor as the culprit.
Yes, I agree. But it still
Yes, I agree. But it still means that drupal's standard editor is probably to blame. Hope drupal developers fix this.
How do you edit your PHP
How do you edit your PHP files?